mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Provide helpful warning for too-large id counts for ConditionSet Condition# lines
This commit is contained in:
parent
e2669dba0c
commit
a933e7a084
1 changed files with 10 additions and 5 deletions
|
|
@ -2865,7 +2865,7 @@ void readconditionset(MYFILE *f, UINT16 setnum)
|
||||||
char *word = s;
|
char *word = s;
|
||||||
char *word2;
|
char *word2;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
UINT8 id;
|
UINT16 id;
|
||||||
UINT8 previd = 0;
|
UINT8 previd = 0;
|
||||||
|
|
||||||
M_ClearConditionSet(setnum);
|
M_ClearConditionSet(setnum);
|
||||||
|
|
@ -2902,21 +2902,26 @@ void readconditionset(MYFILE *f, UINT16 setnum)
|
||||||
|
|
||||||
if (fastncmp(word, "CONDITION", 9))
|
if (fastncmp(word, "CONDITION", 9))
|
||||||
{
|
{
|
||||||
id = (UINT8)atoi(word + 9);
|
id = atoi(word + 9);
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
deh_warning("Condition set %d: unknown word '%s'", setnum+1, word);
|
deh_warning("Condition set %d: unknown word '%s'", setnum+1, word);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (previd > id)
|
if (previd > id)
|
||||||
{
|
{
|
||||||
// out of order conditions can cause problems, so enforce proper order
|
// out of order conditions can cause problems, so enforce proper order
|
||||||
deh_warning("Condition set %d: conditions are out of order, ignoring this line", setnum+1);
|
deh_warning("Condition set %d: conditions are out of order, ignoring this line", setnum+1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
previd = id;
|
if (id > UINT8_MAX)
|
||||||
|
{
|
||||||
|
deh_warning("Condition set %d: too many Condition# types, ignoring this line", setnum+1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
previd = (UINT8)id;
|
||||||
|
|
||||||
readcondition(setnum, id, word2);
|
readcondition(setnum, (UINT8)id, word2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
deh_warning("Condition set %d: unknown word '%s'", setnum, word);
|
deh_warning("Condition set %d: unknown word '%s'", setnum, word);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue