From: Mircea Kitsune Date: Fri, 10 Jan 2020 20:00:24 +0000 (+0000) Subject: Allow campaign levels to specify leadlimit X-Git-Tag: xonotic-v0.8.5~1105^2~27^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ca7f7b7b01d546612dec51af1d548054f3513f5a;p=xonotic%2Fxonotic-data.pk3dir.git Allow campaign levels to specify leadlimit --- diff --git a/qcsrc/common/campaign_common.qh b/qcsrc/common/campaign_common.qh index 25c008d26..088aefea0 100644 --- a/qcsrc/common/campaign_common.qh +++ b/qcsrc/common/campaign_common.qh @@ -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]; diff --git a/qcsrc/common/campaign_file.qc b/qcsrc/common/campaign_file.qc index 4f099b533..8bac6f35e 100644 --- a/qcsrc/common/campaign_file.qc +++ b/qcsrc/common/campaign_file.qc @@ -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]); diff --git a/qcsrc/server/campaign.qc b/qcsrc/server/campaign.qc index 5c26da9ed..ea5af0438 100644 --- a/qcsrc/server/campaign.qc +++ b/qcsrc/server/campaign.qc @@ -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]); + } } }