mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Gamedata: Fix issues with cup windata handling
- G_SaveGameData: correctly increase length of buffer to account for cup name - G_LoadGameData: digest the cup's associated windata even if it's not loaded
This commit is contained in:
parent
b0a028c756
commit
c33ae4ae62
1 changed files with 11 additions and 6 deletions
17
src/g_game.c
17
src/g_game.c
|
|
@ -4721,16 +4721,23 @@ void G_LoadGameData(void)
|
||||||
char cupname[16];
|
char cupname[16];
|
||||||
cupheader_t *cup;
|
cupheader_t *cup;
|
||||||
|
|
||||||
|
// Find the relevant cup.
|
||||||
READSTRINGN(save.p, cupname, sizeof(cupname));
|
READSTRINGN(save.p, cupname, sizeof(cupname));
|
||||||
for (cup = kartcupheaders; cup; cup = cup->next)
|
for (cup = kartcupheaders; cup; cup = cup->next)
|
||||||
{
|
{
|
||||||
if (strcmp(cup->name, cupname))
|
if (strcmp(cup->name, cupname))
|
||||||
continue;
|
continue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for (j = 0; j < KARTGP_MAX; j++)
|
// Digest its data...
|
||||||
|
for (j = 0; j < KARTGP_MAX; j++)
|
||||||
|
{
|
||||||
|
rtemp = READUINT8(save.p);
|
||||||
|
|
||||||
|
// ...but only record it if we actually found the associated cup.
|
||||||
|
if (cup)
|
||||||
{
|
{
|
||||||
rtemp = READUINT8(save.p);
|
|
||||||
|
|
||||||
cup->windata[j].best_placement = (rtemp & 0x0F);
|
cup->windata[j].best_placement = (rtemp & 0x0F);
|
||||||
cup->windata[j].best_grade = (rtemp & 0x70)>>4;
|
cup->windata[j].best_grade = (rtemp & 0x70)>>4;
|
||||||
if (rtemp & 0x80)
|
if (rtemp & 0x80)
|
||||||
|
|
@ -4741,8 +4748,6 @@ void G_LoadGameData(void)
|
||||||
cup->windata[j].got_emerald = true;
|
cup->windata[j].got_emerald = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4819,7 +4824,7 @@ void G_SaveGameData(boolean dirty)
|
||||||
{
|
{
|
||||||
numcups++;
|
numcups++;
|
||||||
}
|
}
|
||||||
length += 4 + (numcups * 4);
|
length += 4 + (numcups * (4+16));
|
||||||
|
|
||||||
if (P_SaveBufferAlloc(&save, length) == false)
|
if (P_SaveBufferAlloc(&save, length) == false)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue