X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fcampaign_file.qc;h=5ab3da67cff47e58a34f3731b1d330d256bb3526;hp=067cd8054de6f311d562bf427190fd806ef1de79;hb=6a28c11c8abd729c7f95ad7050d204aa2453d2ff;hpb=128c68b3e475d812ab3aa81a1aab0648a7d80505 diff --git a/qcsrc/common/campaign_file.qc b/qcsrc/common/campaign_file.qc index 067cd8054d..5ab3da67cf 100644 --- a/qcsrc/common/campaign_file.qc +++ b/qcsrc/common/campaign_file.qc @@ -38,13 +38,12 @@ float CampaignFile_Load(float offset, float n) { entlen = tokenize(l); // using insane tokenizer for CSV -#define CAMPAIGN_GETARG0 if(i >= entlen) -#define CAMPAIGN_GETARG1 CAMPAIGN_GETARG0 error("syntax error in campaign file: line has not enough fields"); -#define CAMPAIGN_GETARG2 CAMPAIGN_GETARG1 a = argv(++i); -#define CAMPAIGN_GETARG3 CAMPAIGN_GETARG2 if(a == ",") -#define CAMPAIGN_GETARG4 CAMPAIGN_GETARG3 a = ""; -#define CAMPAIGN_GETARG5 CAMPAIGN_GETARG4 else -#define CAMPAIGN_GETARG CAMPAIGN_GETARG5 ++i +#define CAMPAIGN_GETARG \ + a = argv(++i); \ + if(a == ",") \ + a = ""; \ + else \ + ++i // What you're seeing here is what people will do when your compiler supports // C-style macros but no line continuations. @@ -58,6 +57,10 @@ float CampaignFile_Load(float offset, float n) 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)); + + if(i > entlen) + error("syntax error in campaign file: line has not enough fields"); + campaign_entries = campaign_entries + 1; if(campaign_entries >= n)