From: terencehill Date: Tue, 29 Oct 2024 15:26:25 +0000 (+0100) Subject: Fix spec_forfeit alias by renaming spec_forfeit_ask to spec_forfeit_dont_ask and... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F1359%2Fhead;p=xonotic%2Fxonotic-data.pk3dir.git Fix spec_forfeit alias by renaming spec_forfeit_ask to spec_forfeit_dont_ask and inverting its logic This way only `spectate "" 01` asks for confirmation, `spectate "" 00|11|10` doesn't --- diff --git a/commands.cfg b/commands.cfg index 8c66f551c..a0f9ce836 100644 --- a/commands.cfg +++ b/commands.cfg @@ -216,8 +216,8 @@ alias team_auto "togglemenu 0; cmd selectteam auto; cmd join" // TODO remove this cvar and related menu code in a later Xonotic version seta _spec_forfeit_bindupdate 0 -seta spec_forfeit_ask 1 "allow asking for forfeit confirmation" -alias spec_forfeit "spectate \"\" ${spec_forfeit_ask}${_menu_forfeit_dialog_available}" +seta spec_forfeit_dont_ask 0 "don't ask for forfeit confirmation" +alias spec_forfeit "spectate \"\" ${spec_forfeit_dont_ask}${_menu_forfeit_dialog_available}" alias spec "spectate ${* ?}" diff --git a/qcsrc/menu/xonotic/dialog_forfeit.qc b/qcsrc/menu/xonotic/dialog_forfeit.qc index efffba232..b61a1d549 100644 --- a/qcsrc/menu/xonotic/dialog_forfeit.qc +++ b/qcsrc/menu/xonotic/dialog_forfeit.qc @@ -26,5 +26,5 @@ void XonoticForfeitDialog_fill(entity me) e.onClickEntity = me; me.TR(me); me.TR(me); - me.TD(me, 1, 2, e = makeXonoticCheckBox(1, "spec_forfeit_ask", _("Never ask again"))); + me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "spec_forfeit_dont_ask", _("Never ask again"))); } diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 4fb7cf5f4..8aa5a4042 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -710,7 +710,8 @@ void ClientCommand_spectate(entity caller, int request) return; } - bool forfeit_ask = (!warmup_stage && stof(argv(2))); + // here we are intentionally checking if argv(2) is exactly 1 + bool forfeit_ask = (!warmup_stage && stof(argv(2)) == 1); if (IS_PLAYER(caller) && forfeit_ask) { @@ -759,7 +760,7 @@ void ClientCommand_spectate(entity caller, int request) sprint(caller, "\nUsage:^3 cmd spectate [] []\n"); sprint(caller, " Where can be the player to spectate.\n"); sprint(caller, " If is \"\" or not specified, caller becomes observer.\n"); - sprint(caller, " If is \"\" and forfeit_ask is not 0 caller will be asked" + sprint(caller, " If is \"\" and forfeit_ask is 1 caller will be asked" " to confirm forfeiting the current game.\n"); return; }