From df0725fcacd8658029c3d9556a213ddb5d0ded62 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 5 Aug 2019 19:35:39 +1000 Subject: [PATCH 1/1] Disable the cvar wrapper system in the campaigns, since it doesn't affect a majority of our cvars --- qcsrc/common/mapinfo.qc | 2 ++ qcsrc/common/mapinfo.qh | 2 ++ qcsrc/server/campaign.qc | 26 +++++++++++++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 617bfe85e2..3e6478b2db 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -717,9 +717,11 @@ void _MapInfo_Parse_Settemp(string pFilename, string acl, float type, string s, if(type == 0) // server set { LOG_TRACE("Applying temporary setting ", t, " := ", s); + #if 0 if(cvar("g_campaign")) cvar_set(t, s); // this is a wrapper and is always temporary anyway; no need to backup old values then else + #endif cvar_settemp(t, s); } else diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index 6fbb7ce896..d27722999a 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -669,6 +669,8 @@ void MapInfo_Cache_Destroy(); // disable caching void MapInfo_Cache_Create(); // enable caching void MapInfo_Cache_Invalidate(); // delete cache if any, but keep enabled +void _MapInfo_Parse_Settemp(string pFilename, string acl, float type, string s, float recurse); + void MapInfo_ClearTemps(); // call this when done with mapinfo for this frame void MapInfo_Shutdown(); // call this in the shutdown handler diff --git a/qcsrc/server/campaign.qc b/qcsrc/server/campaign.qc index ddc7e47fa6..76e2cdeb84 100644 --- a/qcsrc/server/campaign.qc +++ b/qcsrc/server/campaign.qc @@ -21,9 +21,11 @@ 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) @@ -31,6 +33,7 @@ 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) { @@ -57,6 +60,7 @@ void cvar_set_campaignwrapper(string theCvar, string theValue) strunzone(s); //print(cvar_campaignwrapper_list, "\n"); } +#endif float Campaign_Invalid() { @@ -104,16 +108,36 @@ 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) + { + for(int j = 0; j < argc; ++j) + { + string arg = argv(j); + if(arg == "") continue; + _MapInfo_Parse_Settemp(mapname, MAPINFO_SETTEMP_ACL_USER, 0, arg, 0); // no recursion! + } + } +#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 -- 2.39.2