Remove the cvar wrappers that existed for the campaign, which are now useless thanks...
authorMario <mario.mario@y7mail.com>
Fri, 29 May 2020 07:31:23 +0000 (17:31 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 29 May 2020 07:31:23 +0000 (17:31 +1000)
qcsrc/lib/log.qh
qcsrc/server/campaign.qc
qcsrc/server/command/common.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/sys-post.qh
qcsrc/server/sys-pre.qh

index 16875c8..e05ad26 100644 (file)
@@ -96,23 +96,17 @@ string(string, string...) strcat1n = #115;
 noref int autocvar_developer;
 noref bool autocvar_prvm_backtraceforwarnings;
 
-#ifdef SVQC
-#define bt_cvar_set(cvar, value) builtin_cvar_set(cvar, value)
-#else
-#define bt_cvar_set(cvar, value) cvar_set(cvar, value)
-#endif
-
 #define backtrace(msg) \
        MACRO_BEGIN \
                int dev = autocvar_developer; \
                bool war = autocvar_prvm_backtraceforwarnings; \
-               bt_cvar_set("developer", "1"); \
-               bt_cvar_set("prvm_backtraceforwarnings", "1"); \
+               cvar_set("developer", "1"); \
+               cvar_set("prvm_backtraceforwarnings", "1"); \
                print("\n--- CUT HERE ---\n", msg); \
                _backtrace(); \
                print("\n--- CUT UNTIL HERE ---\n"); \
-               bt_cvar_set("developer", ftos(dev)); \
-               bt_cvar_set("prvm_backtraceforwarnings", ftos(war)); \
+               cvar_set("developer", ftos(dev)); \
+               cvar_set("prvm_backtraceforwarnings", ftos(war)); \
        MACRO_END
 
 void print_assertfailed_severe(string expr)
index 110704f..1a01868 100644 (file)
@@ -21,11 +21,6 @@ string campaign_index_var;
 
 float CampaignBailout(string s)
 {
-#if 0
-       cvar = cvar_normal;
-       cvar_string = cvar_string_normal;
-       cvar_set = cvar_set_normal;
-#endif
        cvar_set("g_campaign", "0");
        LOG_INFO("^4campaign initialization failed: ", s);
        if(autocvar__campaign_testrun)
@@ -33,35 +28,6 @@ float CampaignBailout(string s)
        return 1;
 }
 
-#if 0
-string cvar_campaignwrapper_list; // string of format ; var value; var value; var value;
-string cvar_string_campaignwrapper(string theCvar)
-{
-       float p, q;
-       p = strstrofs(cvar_campaignwrapper_list, strcat("; ", theCvar, " "), 0);
-       if(p < 0)
-               return cvar_defstring(theCvar);
-       p += strlen(theCvar) + 3;
-       q = strstrofs(cvar_campaignwrapper_list, ";", p);
-       if(q < 0)
-               return cvar_defstring(theCvar);
-       return substring(cvar_campaignwrapper_list, p, q - p);
-}
-float cvar_campaignwrapper(string theCvar)
-{
-       return stof(cvar_string_campaignwrapper(theCvar));
-}
-void cvar_set_campaignwrapper(string theCvar, string theValue)
-{
-       if(cvar_string_campaignwrapper(theCvar) == theValue)
-               return;
-       string s = cvar_campaignwrapper_list;
-       cvar_campaignwrapper_list = strzone(strcat("; ", theCvar, " ", theValue, s));
-       strunzone(s);
-       //print(cvar_campaignwrapper_list, "\n");
-}
-#endif
-
 float Campaign_Invalid()
 {
        string thismapname, wantedmapname;
@@ -113,9 +79,6 @@ void CampaignPreInit()
        cvar_set("sv_public", "0");
        cvar_set("pausable", "1");
 
-#if 0
-       cvar_campaignwrapper_list = strzone(strcat("; ", campaign_mutators[0], "; "));
-#else
        string cvar_campaignwrapper_list = strcat("; ", campaign_mutators[0], "; ");
        int argc = tokenizebyseparator(cvar_campaignwrapper_list, "; ");
        if(argc > 0)
@@ -127,27 +90,13 @@ void CampaignPreInit()
                        _MapInfo_Parse_Settemp(mapname, MAPINFO_SETTEMP_ACL_USER, 0, arg, 1);
                }
        }
-#endif
-
-#if 0
-       cvar = cvar_campaignwrapper;
-       cvar_string = cvar_string_campaignwrapper;
-       cvar_set = cvar_set_campaignwrapper;
-       cvar_set("g_campaign", "1");
-       cvar_set("g_dm", "0");
-       cvar_set("skill", ftos(baseskill));
-       cvar_set("bot_number", ftos(campaign_bots[0]));
-#else
+
        cvar_settemp("g_campaign", "1");
        cvar_settemp("g_dm", "0");
        cvar_settemp("skill", ftos(baseskill));
        cvar_settemp("bot_number", ftos(campaign_bots[0]));
-#endif
-       MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0]));
 
-       // copy sv_gravity cvar, as the engine needs it too (sorry, this will mess
-       // with the menu a little still...)
-       cvar_set_normal("sv_gravity", ftos(autocvar_sv_gravity));
+       MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0]));
 
        if(Campaign_Invalid())
                return;
@@ -163,9 +112,6 @@ void CampaignPostInit()
                cvar_set("fraglimit", "0");
                cvar_set("leadlimit", "0");
                cvar_set("timelimit", "0.01");
-               cvar_set_normal("fraglimit", "0");
-               cvar_set_normal("leadlimit", "0");
-               cvar_set_normal("timelimit", "0.01");
        }
        else
        {
@@ -173,15 +119,12 @@ void CampaignPostInit()
                tokenizebyseparator(campaign_fraglimit[0], "+");
                if(argv(0) != "default") {
                        cvar_set("fraglimit", argv(0));
-                       cvar_set_normal("fraglimit", argv(0));
                }
                if(argv(1) != "default") {
                        cvar_set("leadlimit", argv(1));
-                       cvar_set_normal("leadlimit", argv(1));
                }
                if(campaign_timelimit[0] != "default") {
                        cvar_set("timelimit", campaign_timelimit[0]);
-                       cvar_set_normal("timelimit", campaign_timelimit[0]);
                }
        }
 }
@@ -194,7 +137,7 @@ void CampaignSaveCvar(string cvarname, float value)
        string l;
 
        registercvar(cvarname, ftos(value));
-       cvar_set_normal(cvarname, ftos(value));
+       cvar_set(cvarname, ftos(value));
        // note: cvarname must be remembered
 
        fh = fopen("campaign.cfg", FILE_READ);
@@ -279,7 +222,7 @@ void CampaignPreIntermission()
 
        if(campaign_won && cheatcount_total == 0 && !autocvar__campaign_testrun)
        {
-               if(campaign_level == cvar_normal(campaign_index_var))
+               if(campaign_level == cvar(campaign_index_var))
                {
                        if(campaign_entries < 2)
                        {
index 6121867..f791446 100644 (file)
@@ -475,7 +475,7 @@ void CommonCommand_info(int request, entity caller, int argc)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       string command = builtin_cvar_string(strcat("sv_info_", argv(1)));
+                       string command = cvar_string(strcat("sv_info_", argv(1)));
 
                        if (command) wordwrap_sprint(caller, command, 1000);
                        else print_to(caller, "ERROR: unsupported info command");
index d9ca813..af6b7b6 100644 (file)
@@ -568,9 +568,6 @@ spawnfunc(__init_dedicated_server)
        // handler for _init/_init map (only for dedicated server initialization)
 
        world_initialized = -1; // don't complain
-       cvar = cvar_normal;
-       cvar_string = cvar_string_normal;
-       cvar_set = cvar_set_normal;
 
        delete_fn = remove_unsafely;
 
@@ -680,8 +677,8 @@ spawnfunc(worldspawn)
                        // localcmd("\nfs_rescan\n"); // FIXME: does more harm than good, has unintended side effects. What we really want is to unload temporary pk3s only
                        // restore csqc_progname too
                        string expect = "csprogs.dat";
-                       wantrestart = cvar_string_normal("csqc_progname") != expect;
-                       cvar_set_normal("csqc_progname", expect);
+                       wantrestart = cvar_string("csqc_progname") != expect;
+                       cvar_set("csqc_progname", expect);
                }
                else
                {
@@ -692,9 +689,9 @@ spawnfunc(worldspawn)
                        // This always works; fall back to it if a versioned csprogs.dat is suddenly missing
                        string select = "csprogs.dat";
                        if (fexists(pk3csprogs)) select = pk3csprogs;
-                       if (cvar_string_normal("csqc_progname") != select)
+                       if (cvar_string("csqc_progname") != select)
                        {
-                               cvar_set_normal("csqc_progname", select);
+                               cvar_set("csqc_progname", select);
                                wantrestart = true;
                        }
                        // Check for updates on startup
@@ -713,13 +710,13 @@ spawnfunc(worldspawn)
                                        string newprogs = sprintf("progs-%s.dat", switchversion);
                                        if (fexists(newprogs))
                                        {
-                                               cvar_set_normal("sv_progs", newprogs);
+                                               cvar_set("sv_progs", newprogs);
                                                wantrestart = true;
                                        }
                                        string newcsprogs = sprintf("csprogs-%s.dat", switchversion);
                                        if (fexists(newcsprogs))
                                        {
-                                               cvar_set_normal("csqc_progname", newcsprogs);
+                                               cvar_set("csqc_progname", newcsprogs);
                                                wantrestart = true;
                                        }
                                }
@@ -733,10 +730,6 @@ spawnfunc(worldspawn)
                }
        }
 
-       cvar = cvar_normal;
-       cvar_string = cvar_string_normal;
-       cvar_set = cvar_set_normal;
-
        if(world_already_spawned)
                error("world already spawned - you may have EXACTLY ONE worldspawn!");
        world_already_spawned = true;
index cb11057..35fc07b 100644 (file)
 #include <common/mapinfo.qh>
 #include <common/turrets/all.qh>
 
-#if 1
-#define cvar_string_normal builtin_cvar_string
-#define cvar_normal builtin_cvar
-#else
-string cvar_string_normal(string n)
-{
-       if (!(cvar_type(n) & CVAR_TYPEFLAG_EXISTS))
-               backtrace(strcat("Attempt to access undefined cvar: ", n));
-       return builtin_cvar_string(n);
-}
-
-float cvar_normal(string n)
-{
-       return stof(cvar_string_normal(n));
-}
-#endif
-#define cvar_set_normal builtin_cvar_set
-
 .vector dropped_origin;
 
 entity eliminatedPlayers;
index 1ccf669..6ccb591 100644 (file)
@@ -2,13 +2,7 @@
 
 #undef droptofloor
 #undef sound
-#undef cvar_set
-#undef cvar_string
-#undef cvar
 
-var float(string name) cvar;
-var string(string name) cvar_string;
-var void(string name, string value) cvar_set;
 var void delete_fn(entity e);
 
 #undef IT_SHOTGUN
index 9799a08..f60bb99 100644 (file)
@@ -1,9 +1,6 @@
 #pragma once
 
 #define droptofloor builtin_droptofloor
-#define cvar_set builtin_cvar_set
-#define cvar_string builtin_cvar_string
-#define cvar builtin_cvar
 
 #define IT_SHOTGUN          _IT_SHOTGUN /* BIT(0) */
 #define IT_SUPER_SHOTGUN    _IT_SUPER_SHOTGUN /* BIT(1) */