Sal's review: Clear levels on gamedata addition by default

Instead, if you want an exception - in the *same* MainCfg block, set `doClearLevels = False` (or `0`, or `No`)
This commit is contained in:
toaster 2022-12-19 21:26:52 +00:00
parent d0cd059c5e
commit 8edf099f78
2 changed files with 11 additions and 15 deletions

View file

@ -2534,6 +2534,7 @@ void readmaincfg(MYFILE *f, boolean mainfile)
char *word2; char *word2;
char *tmp; char *tmp;
INT32 value; INT32 value;
boolean doClearLevels = false;
do do
{ {
@ -2604,11 +2605,16 @@ void readmaincfg(MYFILE *f, boolean mainfile)
clear_conditionsets(); clear_conditionsets();
clear_emblems(); clear_emblems();
//clear_levels(); //clear_levels();
doClearLevels = true;
} }
else if (!mainfile && !gamedataadded) else if (!mainfile && !gamedataadded)
{ {
deh_warning("You must define a custom gamedata to use \"%s\"", word); deh_warning("You must define a custom gamedata to use \"%s\"", word);
} }
else if (fastcmp(word, "CLEARLEVELS"))
{
doClearLevels = (UINT8)(value == 0 || word2[0] == 'F' || word2[0] == 'N');
}
else if (fastcmp(word, "EXECCFG")) else if (fastcmp(word, "EXECCFG"))
{ {
if (strchr(word2, '.')) if (strchr(word2, '.'))
@ -2818,6 +2824,11 @@ void readmaincfg(MYFILE *f, boolean mainfile)
} }
} while (!myfeof(f)); } while (!myfeof(f));
if (doClearLevels)
{
clear_levels();
}
Z_Free(s); Z_Free(s);
} }

View file

@ -542,21 +542,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
{ {
deh_warning("Patch is only compatible with base SRB2."); deh_warning("Patch is only compatible with base SRB2.");
} }
// Clear all data in certain locations (mostly for unlocks)
// Unless you REALLY want to piss people off,
// define a custom gamedata /before/ doing this!!
// (then again, modifiedgame will prevent game data saving anyway)
else if (fastcmp(word, "CLEAR"))
{
if (!mainfile && !gamedataadded)
{
deh_warning("You must define a custom gamedata to use \"%s\"", word);
continue;
}
if (fastcmp(word2, "LEVELS"))
clear_levels();
}
else else
deh_warning("Unknown word: %s", word); deh_warning("Unknown word: %s", word);
} }