mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-12 11:03:02 +00:00
Fix cup level list behaviour
- Frees existing string data - Unbinds cup backreference here instead of in p_setup
This commit is contained in:
parent
19e427f5db
commit
21be55e924
2 changed files with 17 additions and 4 deletions
|
|
@ -3052,7 +3052,15 @@ void readcupheader(MYFILE *f, cupheader_t *cup)
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "LEVELLIST"))
|
else if (fastcmp(word, "LEVELLIST"))
|
||||||
{
|
{
|
||||||
cup->numlevels = 0;
|
while (cup->numlevels > 0)
|
||||||
|
{
|
||||||
|
cup->numlevels--;
|
||||||
|
Z_Free(cup->levellist[cup->numlevels]);
|
||||||
|
cup->levellist[cup->numlevels] = NULL;
|
||||||
|
if (cup->cachedlevels[cup->numlevels] == NEXTMAP_INVALID)
|
||||||
|
continue;
|
||||||
|
mapheaderinfo[cup->cachedlevels[cup->numlevels]]->cup = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
tmp = strtok(word2,",");
|
tmp = strtok(word2,",");
|
||||||
do {
|
do {
|
||||||
|
|
@ -3069,11 +3077,13 @@ void readcupheader(MYFILE *f, cupheader_t *cup)
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "BONUSGAME"))
|
else if (fastcmp(word, "BONUSGAME"))
|
||||||
{
|
{
|
||||||
|
Z_Free(cup->levellist[CUPCACHE_BONUS]);
|
||||||
cup->levellist[CUPCACHE_BONUS] = Z_StrDup(word2);
|
cup->levellist[CUPCACHE_BONUS] = Z_StrDup(word2);
|
||||||
cup->cachedlevels[CUPCACHE_BONUS] = NEXTMAP_INVALID;
|
cup->cachedlevels[CUPCACHE_BONUS] = NEXTMAP_INVALID;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "SPECIALSTAGE"))
|
else if (fastcmp(word, "SPECIALSTAGE"))
|
||||||
{
|
{
|
||||||
|
Z_Free(cup->levellist[CUPCACHE_SPECIAL]);
|
||||||
cup->levellist[CUPCACHE_SPECIAL] = Z_StrDup(word2);
|
cup->levellist[CUPCACHE_SPECIAL] = Z_StrDup(word2);
|
||||||
cup->cachedlevels[CUPCACHE_SPECIAL] = NEXTMAP_INVALID;
|
cup->cachedlevels[CUPCACHE_SPECIAL] = NEXTMAP_INVALID;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4487,17 +4487,20 @@ UINT8 P_InitMapData(INT32 numexistingmapheaders)
|
||||||
cupheader_t *cup = kartcupheaders;
|
cupheader_t *cup = kartcupheaders;
|
||||||
INT32 j;
|
INT32 j;
|
||||||
|
|
||||||
mapheaderinfo[i]->cup = NULL;
|
|
||||||
|
|
||||||
while (cup)
|
while (cup)
|
||||||
{
|
{
|
||||||
for (j = 0; j < CUPCACHE_MAX; j++)
|
for (j = 0; j < CUPCACHE_MAX; j++)
|
||||||
{
|
{
|
||||||
|
// No level in this slot?
|
||||||
|
if (!cup->levellist[j])
|
||||||
|
continue;
|
||||||
|
|
||||||
// Already discovered?
|
// Already discovered?
|
||||||
if (cup->cachedlevels[j] != NEXTMAP_INVALID)
|
if (cup->cachedlevels[j] != NEXTMAP_INVALID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!cup->levellist[j] || strcasecmp(cup->levellist[j], name) != 0)
|
// Not your name?
|
||||||
|
if (strcasecmp(cup->levellist[j], name) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Only panic about back-reference for non-bonus material.
|
// Only panic about back-reference for non-bonus material.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue