Merge branch 'bad-ghost-crash-fix' into 'master'

Defer ghost deallocation til FreeGhosts

Closes #824

See merge request KartKrew/Kart!1769
This commit is contained in:
Oni 2024-01-06 00:51:37 +00:00
commit 0e854b5340
2 changed files with 13 additions and 6 deletions

View file

@ -1226,11 +1226,16 @@ void G_ConsGhostTic(INT32 playernum)
void G_GhostTicker(void)
{
demoghost *g,*p;
for(g = ghosts, p = NULL; g; g = g->next)
for (g = ghosts, p = NULL; g; g = g->next)
{
UINT16 ziptic;
UINT8 xziptic;
if (g->done)
{
continue;
}
// Pause jhosts that cross until we cross ourself.
if (g->linecrossed && !linecrossed)
continue;
@ -1276,7 +1281,9 @@ readghosttic:
}
}
else
I_Error("Ghost is not a record attack ghost DXD"); //@TODO lmao don't blow up like this
{
I_Error("Ghost is not a record attack ghost DXD (ziptic = %u)", ziptic); //@TODO lmao don't blow up like this
}
ziptic = READUINT8(g->p);
}
@ -1532,12 +1539,11 @@ skippedghosttic:
if (follow)
follow->fuse = TICRATE;
#endif
g->done = true;
if (p)
{
p->next = g->next;
else
ghosts = g->next;
Z_Free(g->skinlist);
Z_Free(g);
}
continue;
}

View file

@ -170,6 +170,7 @@ struct demoghost {
UINT16 version;
UINT8 numskins;
boolean linecrossed;
boolean done;
democharlist_t *skinlist;
mobj_t oldmo, *mo;
struct demoghost *next;