mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
When doubling the cupgrid.builtgrid, memset the new region to prevent bad info
This commit is contained in:
parent
6659e78c04
commit
286331b5c9
1 changed files with 5 additions and 2 deletions
|
|
@ -3523,10 +3523,13 @@ static void M_LevelListFromGametype(INT16 gt)
|
||||||
|
|
||||||
if (((currentid / (CUPMENU_COLUMNS * CUPMENU_ROWS)) + 1) >= cupgrid.cappages)
|
if (((currentid / (CUPMENU_COLUMNS * CUPMENU_ROWS)) + 1) >= cupgrid.cappages)
|
||||||
{
|
{
|
||||||
cupgrid.cappages *= 2;
|
// Double the size of the buffer, and clear the other stuff.
|
||||||
|
size_t firstlen = sizeof(cupheader_t*) * cupgrid.cappages * (CUPMENU_COLUMNS * CUPMENU_ROWS);
|
||||||
cupgrid.builtgrid = Z_Realloc(cupgrid.builtgrid,
|
cupgrid.builtgrid = Z_Realloc(cupgrid.builtgrid,
|
||||||
sizeof(cupheader_t*) * cupgrid.cappages * (CUPMENU_COLUMNS * CUPMENU_ROWS),
|
firstlen * 2,
|
||||||
PU_STATIC, NULL);
|
PU_STATIC, NULL);
|
||||||
|
memset(cupgrid.builtgrid + firstlen, 0, firstlen);
|
||||||
|
cupgrid.cappages *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
cupgrid.builtgrid[currentid] = cup;
|
cupgrid.builtgrid[currentid] = cup;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue