how did saving even work in original III?

This commit is contained in:
Nikolay Korolev 2020-05-24 15:58:25 +03:00
parent 8c510a8d5b
commit 8705562559

View file

@ -2119,12 +2119,8 @@ void CGarages::SetAllDoorsBackToOriginalHeight()
// TODO(MIAMI) // TODO(MIAMI)
void CGarages::Save(uint8 * buf, uint32 * size) void CGarages::Save(uint8 * buf, uint32 * size)
{ {
#ifdef FIX_GARAGE_SIZE INITSAVEBUF
INITSAVEBUF *size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
#else
* size = 5484;
#endif
CloseHideOutGaragesBeforeSave(); CloseHideOutGaragesBeforeSave();
WriteSaveBuf(buf, NumGarages); WriteSaveBuf(buf, NumGarages);
WriteSaveBuf(buf, (uint32)BombsAreFree); WriteSaveBuf(buf, (uint32)BombsAreFree);
@ -2142,9 +2138,7 @@ void CGarages::Save(uint8 * buf, uint32 * size)
} }
for (int i = 0; i < NUM_GARAGES; i++) for (int i = 0; i < NUM_GARAGES; i++)
WriteSaveBuf(buf, aGarages[i]); WriteSaveBuf(buf, aGarages[i]);
#ifdef FIX_GARAGE_SIZE VALIDATESAVEBUF(*size);
VALIDATESAVEBUF(*size);
#endif
} }
const CStoredCar &CStoredCar::operator=(const CStoredCar & other) const CStoredCar &CStoredCar::operator=(const CStoredCar & other)
@ -2169,12 +2163,8 @@ const CStoredCar &CStoredCar::operator=(const CStoredCar & other)
//TODO(MIAMI) //TODO(MIAMI)
void CGarages::Load(uint8* buf, uint32 size) void CGarages::Load(uint8* buf, uint32 size)
{ {
#ifdef FIX_GARAGE_SIZE INITSAVEBUF
INITSAVEBUF assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)));
assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
#else
assert(size == 5484);
#endif
CloseHideOutGaragesBeforeSave(); CloseHideOutGaragesBeforeSave();
NumGarages = ReadSaveBuf<uint32>(buf); NumGarages = ReadSaveBuf<uint32>(buf);
BombsAreFree = ReadSaveBuf<uint32>(buf); BombsAreFree = ReadSaveBuf<uint32>(buf);
@ -2203,9 +2193,7 @@ void CGarages::Load(uint8* buf, uint32 size)
else else
aGarages[i].UpdateDoorsHeight(); aGarages[i].UpdateDoorsHeight();
} }
#ifdef FIX_GARAGE_SIZE VALIDATESAVEBUF(size);
VALIDATESAVEBUF(size);
#endif
MessageEndTime = 0; MessageEndTime = 0;
bCamShouldBeOutisde = false; bCamShouldBeOutisde = false;