Comment out ITEM_LIST_SIZE, Fix CheckHeap crash on item roulette (re)alloc.

Also change the default item cap to 32, since the free item roulette makes it go up to 30, avoiding a bunch of unneeded reallocs.
This commit is contained in:
JugadorXEI 2024-11-01 17:44:22 +01:00 committed by AJ Martinez
parent b2fae10b48
commit 753657bd36
3 changed files with 8 additions and 8 deletions

View file

@ -506,9 +506,9 @@ struct skybox_t {
}; };
// player_t struct for item roulette variables // player_t struct for item roulette variables
// Doing this the right way is causing problems.
// so FINE, it's a static length now. // In case of dynamic alloc failure, break glass:
#define ITEM_LIST_SIZE (NUMKARTRESULTS << 3) // #define ITEM_LIST_SIZE (NUMKARTRESULTS << 3)
typedef struct itemlist_t typedef struct itemlist_t
{ {

View file

@ -737,11 +737,11 @@ static void K_InitRoulette(itemroulette_t *const roulette)
#ifndef ITEM_LIST_SIZE #ifndef ITEM_LIST_SIZE
if (roulette->itemList.items == NULL) if (roulette->itemList.items == NULL)
{ {
roulette->itemList.cap = 8; roulette->itemList.cap = 32;
roulette->itemList.items = Z_Calloc( roulette->itemList.items = Z_Calloc(
sizeof(SINT8) * roulette->itemList.cap, sizeof(SINT8) * roulette->itemList.cap,
PU_STATIC, PU_STATIC,
&roulette->itemList.items NULL
); );
if (roulette->itemList.items == NULL) if (roulette->itemList.items == NULL)
@ -844,7 +844,7 @@ void K_PushToRouletteItemList(itemroulette_t *const roulette, INT32 item)
roulette->itemList.items, roulette->itemList.items,
sizeof(SINT8) * roulette->itemList.cap, sizeof(SINT8) * roulette->itemList.cap,
PU_STATIC, PU_STATIC,
&roulette->itemList.items NULL
); );
if (roulette->itemList.items == NULL) if (roulette->itemList.items == NULL)

View file

@ -1452,7 +1452,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].itemRoulette.itemList.items = Z_Calloc( players[i].itemRoulette.itemList.items = Z_Calloc(
sizeof(SINT8) * players[i].itemRoulette.itemList.cap, sizeof(SINT8) * players[i].itemRoulette.itemList.cap,
PU_STATIC, PU_STATIC,
&players[i].itemRoulette.itemList.items NULL
); );
} }
else else
@ -1461,7 +1461,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].itemRoulette.itemList.items, players[i].itemRoulette.itemList.items,
sizeof(SINT8) * players[i].itemRoulette.itemList.cap, sizeof(SINT8) * players[i].itemRoulette.itemList.cap,
PU_STATIC, PU_STATIC,
&players[i].itemRoulette.itemList.items NULL
); );
} }