X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fcampaign_file.qc;h=d9864f4da7e1c73fc7300ee69bb61b3589cc051c;hb=d86869ae654e8fe9d36e840a4086cc77bedcb0f4;hp=89b24ce513270025a87e58f802b1dbb00a4313b7;hpb=0e7ed909bffb4ff21f0c68d163edfc17487e380a;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/campaign_file.qc b/qcsrc/common/campaign_file.qc index 89b24ce51..d9864f4da 100644 --- a/qcsrc/common/campaign_file.qc +++ b/qcsrc/common/campaign_file.qc @@ -18,7 +18,7 @@ float CampaignFile_Load(float offset, float n) campaign_entries = 0; campaign_title = string_null; - fn = strcat("maps/campaign", campaign_name, ".txt"); + fn = language_filename(strcat("maps/campaign", campaign_name, ".txt")); fh = fopen(fn, FILE_READ); if(fh >= 0) { @@ -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. @@ -54,9 +53,14 @@ float CampaignFile_Load(float offset, float n) 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_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)