Rollover protection for unloaded mapheader record tracking system

You will run into memory limits before this happens, but... if you have major quantities of unloaded mapheader record data, avoid a rollover in the counter of records to write.
This commit is contained in:
toaster 2023-05-24 18:24:58 +01:00
parent 28677da5b9
commit 3027d254fe

View file

@ -5141,7 +5141,12 @@ void G_SaveGameData(void)
continue;
}
numgamedatamapheaders++;
// It's far off on the horizon, beyond many memory limits, but prevent a potential misery moment of losing ALL your data.
if (++numgamedatamapheaders == UINT32_MAX)
{
CONS_Alert(CONS_WARNING, "Some unloaded map record data has been dropped due to datatype limitations.\n");
break;
}
}
length += 4 + (numgamedatamapheaders * (MAXMAPLUMPNAME+1+4+4));