]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix spec_forfeit alias by renaming spec_forfeit_ask to spec_forfeit_dont_ask and... terencehill/forfeit_dialog 1359/head
authorterencehill <piuntn@gmail.com>
Tue, 29 Oct 2024 15:26:25 +0000 (16:26 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 29 Oct 2024 15:26:25 +0000 (16:26 +0100)
This way only `spectate "" 01` asks for confirmation, `spectate "" 00|11|10` doesn't

commands.cfg
qcsrc/menu/xonotic/dialog_forfeit.qc
qcsrc/server/command/cmd.qc

index 8c66f551c5722a57f7ac81b109e8fee60da68cd2..a0f9ce8365604d155f1f3345f6a8fb1e48ad5f62 100644 (file)
@@ -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 ${* ?}"
 
index efffba232f5d60713e638fb9cb97e0448b62510c..b61a1d549de53984196c27e02d3456d8523b516b 100644 (file)
@@ -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")));
 }
index 4fb7cf5f4fc396a3bf7ce8af2705c11ae8960c00..8aa5a40428c694f3999be55ebe3bdaa37c3b0c9f 100644 (file)
@@ -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 [<client>] [<ask_forfeit>]\n");
                        sprint(caller, "  Where <client> can be the player to spectate.\n");
                        sprint(caller, "  If <client> is \"\" or not specified, caller becomes observer.\n");
-                       sprint(caller, "  If <client> is \"\" and forfeit_ask is not 0 caller will be asked"
+                       sprint(caller, "  If <client> is \"\" and forfeit_ask is 1 caller will be asked"
                                         " to confirm forfeiting the current game.\n");
                        return;
                }