mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-18 03:22:35 +00:00
G_WriteAllGhostTics: check buffer size after each player's ghost data
Instead of checking it after ALL player ghost data. This is less likely to write past the end of the demo buffer.
This commit is contained in:
parent
a879975e83
commit
5a86041302
1 changed files with 10 additions and 3 deletions
13
src/g_demo.c
13
src/g_demo.c
|
|
@ -734,6 +734,7 @@ void G_GhostAddHit(INT32 playernum, mobj_t *victim)
|
|||
|
||||
void G_WriteAllGhostTics(void)
|
||||
{
|
||||
boolean toobig = false;
|
||||
INT32 i, counter = leveltime;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
|
@ -750,12 +751,18 @@ void G_WriteAllGhostTics(void)
|
|||
|
||||
WRITEUINT8(demobuf.p, i);
|
||||
G_WriteGhostTic(players[i].mo, i);
|
||||
|
||||
// attention here for the ticcmd size!
|
||||
// latest demos with mouse aiming byte in ticcmd
|
||||
if (demobuf.p >= demobuf.end - (13 + 9 + 9))
|
||||
{
|
||||
toobig = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
WRITEUINT8(demobuf.p, 0xFF);
|
||||
|
||||
// attention here for the ticcmd size!
|
||||
// latest demos with mouse aiming byte in ticcmd
|
||||
if (demobuf.p >= demobuf.end - (13 + 9 + 9))
|
||||
if (toobig)
|
||||
{
|
||||
G_CheckDemoStatus(); // no more space
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue