X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fcampaign_file.qc;h=8bac6f35ee05678647caf62ec410df13bf5da770;hp=5ab3da67cff47e58a34f3731b1d330d256bb3526;hb=4eab3f0253a063bdbd4e1ff64c4b2b08077c44c4;hpb=f879dea04474678d9a263cf5d8c127415e390ca5 diff --git a/qcsrc/common/campaign_file.qc b/qcsrc/common/campaign_file.qc index 5ab3da67c..8bac6f35e 100644 --- a/qcsrc/common/campaign_file.qc +++ b/qcsrc/common/campaign_file.qc @@ -1,8 +1,16 @@ +#include "campaign_file.qh" +#if defined(CSQC) +#elif defined(MENUQC) +#elif defined(SVQC) + #include "util.qh" + #include "campaign_common.qh" +#endif + // CampaignFileLoad(offset, n) // - Loads campaign level data (up to n entries starting at offset) // into the globals // - Returns the number of entries successfully read -float CampaignFile_Load(float offset, float n) +float CampaignFile_Load(int offset, float n) { float fh; float lineno; @@ -44,16 +52,14 @@ float CampaignFile_Load(float offset, float n) a = ""; \ else \ ++i -// What you're seeing here is what people will do when your compiler supports -// C-style macros but no line continuations. i = -1; // starts at -1 so I don't need postincrement; that is, i points to BEFORE the current arg! CAMPAIGN_GETARG; campaign_gametype[campaign_entries] = strzone(a); 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)); @@ -63,7 +69,7 @@ float CampaignFile_Load(float offset, float n) campaign_entries = campaign_entries + 1; - if(campaign_entries >= n) + if(campaign_entries >= n) break; } lineno = lineno + 1; @@ -78,19 +84,19 @@ float CampaignFile_Load(float offset, float n) void CampaignFile_Unload() { - float i; if(campaign_title) { - strunzone(campaign_title); - for(i = 0; i < campaign_entries; ++i) + strfree(campaign_title); + for(int i = 0; i < campaign_entries; ++i) { - strunzone(campaign_gametype[i]); - strunzone(campaign_mapname[i]); - strunzone(campaign_mutators[i]); - strunzone(campaign_shortdesc[i]); - strunzone(campaign_longdesc[i]); + 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]); } campaign_entries = 0; - campaign_title = string_null; } }