mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-10 19:01:50 +00:00
Sanity checking and cleanup
This commit is contained in:
parent
4dbb7707e7
commit
116d8d8f99
3 changed files with 12 additions and 8 deletions
|
|
@ -1166,17 +1166,24 @@ void readlevelheader(MYFILE *f, char * name)
|
||||||
else if (fastcmp(word, "MUSIC"))
|
else if (fastcmp(word, "MUSIC"))
|
||||||
{
|
{
|
||||||
if (fastcmp(word2, "NONE"))
|
if (fastcmp(word2, "NONE"))
|
||||||
|
{
|
||||||
mapheaderinfo[num]->musname[0][0] = 0; // becomes empty string
|
mapheaderinfo[num]->musname[0][0] = 0; // becomes empty string
|
||||||
|
mapheaderinfo[num]->musname_size = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT8 j = 0; // i was declared elsewhere
|
UINT8 j = 0; // i was declared elsewhere
|
||||||
tmp = strtok(word2, ",");
|
tmp = strtok(word2, ",");
|
||||||
do {
|
do {
|
||||||
|
if (j >= MAXMUSNAMES)
|
||||||
|
break;
|
||||||
deh_strlcpy(mapheaderinfo[num]->musname[j], tmp,
|
deh_strlcpy(mapheaderinfo[num]->musname[j], tmp,
|
||||||
sizeof(mapheaderinfo[num]->musname[j]), va("Level header %d: music", num));
|
sizeof(mapheaderinfo[num]->musname[j]), va("Level header %d: music", num));
|
||||||
if (j < MAXMUSNAMES)
|
j++;
|
||||||
j++;
|
|
||||||
} while ((tmp = strtok(NULL,",")) != NULL);
|
} while ((tmp = strtok(NULL,",")) != NULL);
|
||||||
|
|
||||||
|
if (tmp != NULL)
|
||||||
|
deh_warning("Level header %d: additional music slots past %d discarded", num, MAXMUSNAMES);
|
||||||
mapheaderinfo[num]->musname_size = j;
|
mapheaderinfo[num]->musname_size = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ typedef enum
|
||||||
|
|
||||||
PR_RULESCRAMBLE, // Rule scrambing events
|
PR_RULESCRAMBLE, // Rule scrambing events
|
||||||
|
|
||||||
|
PR_MUSICSELECT, // Randomized music selection
|
||||||
|
|
||||||
PR_ITEM_ROULETTE, // Item results
|
PR_ITEM_ROULETTE, // Item results
|
||||||
PR_ITEM_RINGS, // Flung ring/bumper/player (on death)
|
PR_ITEM_RINGS, // Flung ring/bumper/player (on death)
|
||||||
PR_ITEM_SHRINK, // Shrink gun offsets
|
PR_ITEM_SHRINK, // Shrink gun offsets
|
||||||
|
|
@ -68,8 +70,6 @@ typedef enum
|
||||||
|
|
||||||
PR_MOVINGTARGET, // Randomised moving targets
|
PR_MOVINGTARGET, // Randomised moving targets
|
||||||
|
|
||||||
PR_MUSICSELECT, // Randomized music selection
|
|
||||||
|
|
||||||
PRNUMCLASS
|
PRNUMCLASS
|
||||||
} pr_class_t;
|
} pr_class_t;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -389,10 +389,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 num)
|
||||||
mapheaderinfo[num]->gravity = DEFAULT_GRAVITY;
|
mapheaderinfo[num]->gravity = DEFAULT_GRAVITY;
|
||||||
mapheaderinfo[num]->keywords[0] = '\0';
|
mapheaderinfo[num]->keywords[0] = '\0';
|
||||||
for (i = 0; i < MAXMUSNAMES; i++)
|
for (i = 0; i < MAXMUSNAMES; i++)
|
||||||
{
|
mapheaderinfo[num]->musname[i][0] = 0;
|
||||||
sprintf(mapheaderinfo[num]->musname[i], "%.5sM", G_BuildMapName(num+1));
|
|
||||||
mapheaderinfo[num]->musname[i][6] = 0;
|
|
||||||
}
|
|
||||||
mapheaderinfo[num]->mustrack = 0;
|
mapheaderinfo[num]->mustrack = 0;
|
||||||
mapheaderinfo[num]->muspos = 0;
|
mapheaderinfo[num]->muspos = 0;
|
||||||
mapheaderinfo[num]->musname_size = 0;
|
mapheaderinfo[num]->musname_size = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue