]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Simplify spec_forfeit (at the cost of sending another cvar to the server)
authorterencehill <piuntn@gmail.com>
Tue, 29 Oct 2024 10:11:32 +0000 (11:11 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 29 Oct 2024 10:11:32 +0000 (11:11 +0100)
commands.cfg
qcsrc/common/replicate.qh
qcsrc/menu/xonotic/dialog_forfeit.qc
qcsrc/server/command/cmd.qc

index 75e052ba23c0598bb796e5fadc2141ff3719d943..b748e8ed227391c9d21302a07851af8e6ad7f29b 100644 (file)
@@ -216,10 +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 menu_ask_forfeit 1 "ask for forfeit confirmation"
-alias spec_forfeit0 "spectate"
-alias spec_forfeit1 "spectate \"\" ASK_FORFEIT"
-alias spec_forfeit "spec_forfeit${menu_ask_forfeit}"
+seta spec_forfeit_ask 1 "allow asking for forfeit confirmation"
+alias spec_forfeit "spectate \"\" ASK_FORFEIT"
 
 alias spec "spectate ${* ?}"
 
index afc1c7b97eeef3f705027ada36135527cf702afa..85298a35d69a6bb01b19422ec5f39d7d104771b6 100644 (file)
@@ -3,6 +3,7 @@
 // TODO: Remove cvar_cl_handicap vector after 0.9 release
 
 #ifdef GAMEQC
+REPLICATE_INIT(bool, cvar_spec_forfeit_ask);
 REPLICATE_INIT(bool, cvar__menu_forfeit_dialog_available);
 REPLICATE_INIT(bool, cvar_cl_autoswitch);
 REPLICATE_INIT(int, cvar_cl_autoscreenshot);
@@ -13,6 +14,7 @@ REPLICATE_INIT(float, cvar_cl_handicap_damage_given);
 REPLICATE_INIT(float, cvar_cl_handicap_damage_taken);
 REPLICATE_INIT(bool, cvar_cl_noantilag);
 REPLICATE_INIT(string, cvar_g_xonoticversion);
+REPLICATE(cvar_spec_forfeit_ask, bool, "spec_forfeit_ask");
 REPLICATE(cvar__menu_forfeit_dialog_available, bool, "_menu_forfeit_dialog_available");
 REPLICATE(cvar_cl_autoswitch, bool, "cl_autoswitch");
 REPLICATE(cvar_cl_autoscreenshot, int, "cl_autoscreenshot");
index 8b67ed63b461a16410f057d12b75a822fda52eca..efffba232f5d60713e638fb9cb97e0448b62510c 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, "menu_ask_forfeit", _("Never ask again")));
+               me.TD(me, 1, 2, e = makeXonoticCheckBox(1, "spec_forfeit_ask", _("Never ask again")));
 }
index 718b74c64e0cccec4c354f841e4f0a86f5039bea..7202a9116ddc652fef14311c7d53bfb6fa919bff 100644 (file)
@@ -710,7 +710,8 @@ void ClientCommand_spectate(entity caller, int request)
                                        return;
                                }
 
-                               bool forfeit_now = (warmup_stage || argv(2) != "ASK_FORFEIT");
+                               bool forfeit_now =
+                                       (warmup_stage || !caller.cvar_spec_forfeit_ask || argv(2) != "ASK_FORFEIT");
 
                                if (IS_PLAYER(caller) && !forfeit_now && caller.cvar__menu_forfeit_dialog_available)
                                {