mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Have replay recording of "hits" use the reference count system, so that it doesn't potentially access free'd memory.
(This is not THE replay fix, but it is A replay fix.)
This commit is contained in:
parent
d22705727b
commit
fa8bffabfc
1 changed files with 2 additions and 1 deletions
|
|
@ -621,7 +621,7 @@ void G_GhostAddHit(INT32 playernum, mobj_t *victim)
|
||||||
ghostext[playernum].flags |= EZT_HIT;
|
ghostext[playernum].flags |= EZT_HIT;
|
||||||
ghostext[playernum].hits++;
|
ghostext[playernum].hits++;
|
||||||
ghostext[playernum].hitlist = Z_Realloc(ghostext[playernum].hitlist, ghostext[playernum].hits * sizeof(mobj_t *), PU_LEVEL, NULL);
|
ghostext[playernum].hitlist = Z_Realloc(ghostext[playernum].hitlist, ghostext[playernum].hits * sizeof(mobj_t *), PU_LEVEL, NULL);
|
||||||
ghostext[playernum].hitlist[ghostext[playernum].hits-1] = victim;
|
P_SetTarget(ghostext[playernum].hitlist + (ghostext[playernum].hits-1), victim);
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_WriteAllGhostTics(void)
|
void G_WriteAllGhostTics(void)
|
||||||
|
|
@ -793,6 +793,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||||
WRITEFIXED(demo_p,mo->y);
|
WRITEFIXED(demo_p,mo->y);
|
||||||
WRITEFIXED(demo_p,mo->z);
|
WRITEFIXED(demo_p,mo->z);
|
||||||
WRITEANGLE(demo_p,mo->angle);
|
WRITEANGLE(demo_p,mo->angle);
|
||||||
|
P_SetTarget(ghostext[playernum].hitlist+i, NULL);
|
||||||
}
|
}
|
||||||
Z_Free(ghostext[playernum].hitlist);
|
Z_Free(ghostext[playernum].hitlist);
|
||||||
ghostext[playernum].hits = 0;
|
ghostext[playernum].hits = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue