]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow campaign levels to specify leadlimit
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 10 Jan 2020 20:00:24 +0000 (20:00 +0000)
committerMartin Taibr <taibr.martin@gmail.com>
Fri, 10 Jan 2020 20:00:24 +0000 (20:00 +0000)
qcsrc/common/campaign_common.qh
qcsrc/common/campaign_file.qc
qcsrc/server/campaign.qc

index 25c008d260d12329b2e16aed6dfdf97fdaf0973d..088aefea09a0479c2061e483491923090653df60 100644 (file)
@@ -11,8 +11,8 @@ string campaign_gametype[CAMPAIGN_MAX_ENTRIES];
 string campaign_mapname[CAMPAIGN_MAX_ENTRIES];
 float campaign_bots[CAMPAIGN_MAX_ENTRIES];
 float campaign_botskill[CAMPAIGN_MAX_ENTRIES];
-float campaign_fraglimit[CAMPAIGN_MAX_ENTRIES];
-float campaign_timelimit[CAMPAIGN_MAX_ENTRIES];
+string campaign_fraglimit[CAMPAIGN_MAX_ENTRIES];
+string campaign_timelimit[CAMPAIGN_MAX_ENTRIES];
 string campaign_mutators[CAMPAIGN_MAX_ENTRIES];
 string campaign_shortdesc[CAMPAIGN_MAX_ENTRIES];
 string campaign_longdesc[CAMPAIGN_MAX_ENTRIES];
index 4f099b53301010a383b9efaa5a27d9e2e5ceebaf..8bac6f35ee05678647caf62ec410df13bf5da770 100644 (file)
@@ -58,8 +58,8 @@ float CampaignFile_Load(int offset, float n)
                                CAMPAIGN_GETARG; campaign_mapname[campaign_entries] = strzone(a);
                                CAMPAIGN_GETARG; campaign_bots[campaign_entries] = stof(a);
                                CAMPAIGN_GETARG; campaign_botskill[campaign_entries] = stof(a);
-                               CAMPAIGN_GETARG; campaign_fraglimit[campaign_entries] = stof(a);
-                               CAMPAIGN_GETARG; campaign_timelimit[campaign_entries] = stof(a);
+                               CAMPAIGN_GETARG; campaign_fraglimit[campaign_entries] = strzone(a);
+                               CAMPAIGN_GETARG; campaign_timelimit[campaign_entries] = strzone(a);
                                CAMPAIGN_GETARG; campaign_mutators[campaign_entries] = strzone(a);
                                CAMPAIGN_GETARG; campaign_shortdesc[campaign_entries] = strzone(a);
                                CAMPAIGN_GETARG; campaign_longdesc[campaign_entries] = strzone(strreplace("\\n", "\n", a));
@@ -91,6 +91,8 @@ void CampaignFile_Unload()
                {
                        strfree(campaign_gametype[i]);
                        strfree(campaign_mapname[i]);
+                       strfree(campaign_fraglimit[i]);
+                       strfree(campaign_timelimit[i]);
                        strfree(campaign_mutators[i]);
                        strfree(campaign_shortdesc[i]);
                        strfree(campaign_longdesc[i]);
index 5c26da9ed4c7e558c865a93d61368be3c3689723..ea5af043823b451f83078463b00b4d7c83742827 100644 (file)
@@ -160,16 +160,28 @@ void CampaignPostInit()
        if(autocvar__campaign_testrun)
        {
                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
        {
-               cvar_set("fraglimit", ftos(campaign_fraglimit[0]));
-               cvar_set("timelimit", ftos(campaign_timelimit[0]));
-               cvar_set_normal("fraglimit", ftos(campaign_fraglimit[0]));
-               cvar_set_normal("timelimit", ftos(campaign_timelimit[0]));
+               // "default" uses implicit values, "" or "0" means no limit
+               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]);
+               }
        }
 }