we dont need to allocate a savebuffer, we just use the savestate one

This commit is contained in:
Alug committed 2025-05-20 17:32:02 +02:00
1 parent 3cd6fe4e34
commit a18662ebce
1 file changed
+1 -25
+1 -25
View File
@@ -6498,27 +6498,7 @@ static boolean CompareTiccmd(const ticcmd_t* a, const ticcmd_t* b)
&& a->forwardmove == b->forwardmove && a->sidemove == b->sidemove;
}
savebuffer_t statesave;
static void makestatesave(void)
{
statesave.buffer = (UINT8 *)malloc(10 * 1024 * 1024);
if (!statesave.buffer)
{
CONS_Alert(CONS_ERROR, M_GetText("No more free memory for savegame\n"));
return;
}
statesave.p = statesave.buffer;
}
static void deletstatesave(void)
{
if (statesave.buffer)
free(statesave.buffer);
statesave.buffer = NULL;
statesave.p = NULL;
}
savebuffer_t statesave = {NULL, NULL};
boolean TryRunTics(tic_t realtics, tic_t entertic)
{
@@ -6579,8 +6559,6 @@ boolean TryRunTics(tic_t realtics, tic_t entertic)
&& (cv_simulate.value && !server) //SRB2Kart: make it impossible to sim before the start of the race
&& (!resynch_local_inprogress && !cl_redownloadinggamestate) && gametic >= SavestatesClearedTic + TICRATE; //do not simulate for one second after clearing
makestatesave(); // allocate our save buffer n shit
if (simtic > gametic && !canSimulate)
{
// if we can't simulate anymore, we ought to reload a valid "server's"
@@ -7115,8 +7093,6 @@ void InvalidateSavestates(void)
gameStateBufferIsValid[i] = false;
}
deletstatesave();
SavestatesClearedTic = gametic;
}