]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Mario/weaponorder' into 'master'
authorMario <mario.mario@y7mail.com>
Mon, 30 Sep 2019 14:05:39 +0000 (14:05 +0000)
committerMario <mario.mario@y7mail.com>
Mon, 30 Sep 2019 14:05:39 +0000 (14:05 +0000)
Merge branch Mario/weaponorder (XS merge request)

Closes #1929

See merge request xonotic/xonotic-data.pk3dir!615

qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh
qcsrc/lib/warpzone/mathlib.qc
qcsrc/server/campaign.qc
qcsrc/tools/compilationunits.sh

index 617bfe85e2cde2c78d3b0f1c8fd1e617732c34df..3e6478b2db50ca25a54716a137d75ca7ba01e4e6 100644 (file)
@@ -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
index 136fb125a4e293b7e03156e222694eef25c831ac..b669ba1f7b63aa2a8c74ab7bc7e1f91caaed1de3 100644 (file)
@@ -672,6 +672,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
index 9105269ff32ebbc00d9c54e832557943412cedd4..cf86d97f9cb5e22e6a2123eaf6f7136630cd590e 100644 (file)
@@ -27,10 +27,13 @@ bool isnan(float e)
        // the sane way to detect NaN is broken because of a compiler bug
        // (works with constants but breaks when assigned to variables)
        // use conversion to string instead
-
        //float f = e;
        //return (e != f);
-       return ftos(e) == "-nan";
+
+       // Negative NaN ("-nan") is much more common but plain "nan" can be created by negating *some* -nans so we need to check both.
+       // DP's QCVM and GMQCC's QCVM behave differently - one needs ftos(-(0.0 / 0.0)), the other ftos(-sqrt(-1)).
+       string s = ftos(e);
+       return s == "nan" || s == "-nan";
 }
 bool isnormal(float e)
 {
index ddc7e47fa6c31386d3ff17c3d9b2d6e0a441ecbc..76e2cdeb8480069230118925719d77d9e105ae5b 100644 (file)
@@ -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
index 68f2eb9d5628ae7df244e70e2ef158be1d69124b..7a7ff17b6d554cbe6451ae2dda773ec81b017088 100755 (executable)
@@ -38,7 +38,11 @@ QCCDEFS="${QCCDEFS[@]}"
 
 declare -a QCCFLAGS=(
     -std=gmqcc
-    -O3 # optimization to accept variable initialization inside `if (1)` blocks and avoid warnings
+    # Without -O3, GMQCC thinks some variables are used uninitialized if the initialization is done inside an `if (1)` block
+    # (which is created by e.g. BEGIN_MACRO) which would cause the compilation units test to fail.
+    # There doesn't appear to be any measurable increase in compile time
+    # and it allows us to get rid of some explicit initializations which are just useless noise.
+    -O3
     -Wall -Werror
     -futf8
     -freturn-assignments