From 2b67aba94cb6448fb24c869559465eddf2bad069 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 25 Jun 2021 19:03:05 +0300 Subject: Redo ReadSaveBuf + common.h cleanup --- src/core/Zones.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/core/Zones.cpp') diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp index cdae85e1..107b1db8 100644 --- a/src/core/Zones.cpp +++ b/src/core/Zones.cpp @@ -8,6 +8,7 @@ #include "Text.h" #include "World.h" #include "Timer.h" +#include "SaveBuf.h" eLevelName CTheZones::m_CurrLevel; CZone *CTheZones::m_pPlayersZone; @@ -696,17 +697,18 @@ void CTheZones::LoadAllZones(uint8 *buffer, uint32 size) { INITSAVEBUF - int i; + int32 i; CheckSaveHeader(buffer, 'Z', 'N', 'S', '\0', size - SAVE_HEADER_SIZE); - m_pPlayersZone = GetPointerForZoneIndex(ReadSaveBuf(buffer)); - m_CurrLevel = ReadSaveBuf(buffer); - FindIndex = ReadSaveBuf(buffer); - ReadSaveBuf(buffer); + ReadSaveBuf(&i, buffer); + m_pPlayersZone = GetPointerForZoneIndex(i); + ReadSaveBuf(&m_CurrLevel, buffer); + ReadSaveBuf(&FindIndex, buffer); + SkipSaveBuf(buffer, 2); for(i = 0; i < ARRAY_SIZE(ZoneArray); i++){ - ZoneArray[i] = ReadSaveBuf(buffer); + ReadSaveBuf(&ZoneArray[i], buffer); ZoneArray[i].child = GetPointerForZoneIndex((uintptr)ZoneArray[i].child); ZoneArray[i].parent = GetPointerForZoneIndex((uintptr)ZoneArray[i].parent); @@ -714,13 +716,13 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 size) } for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++) - ZoneInfoArray[i] = ReadSaveBuf(buffer); + ReadSaveBuf(&ZoneInfoArray[i], buffer); - TotalNumberOfZones = ReadSaveBuf(buffer); - TotalNumberOfZoneInfos = ReadSaveBuf(buffer); + ReadSaveBuf(&TotalNumberOfZones, buffer); + ReadSaveBuf(&TotalNumberOfZoneInfos, buffer); for(i = 0; i < ARRAY_SIZE(MapZoneArray); i++){ - MapZoneArray[i] = ReadSaveBuf(buffer); + ReadSaveBuf(&MapZoneArray[i], buffer); /* The call of GetPointerForZoneIndex is wrong, as it is @@ -736,10 +738,10 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 size) } for(i = 0; i < ARRAY_SIZE(AudioZoneArray); i++) - AudioZoneArray[i] = ReadSaveBuf(buffer); + ReadSaveBuf(&AudioZoneArray[i], buffer); - TotalNumberOfMapZones = ReadSaveBuf(buffer); - NumberOfAudioZones = ReadSaveBuf(buffer); + ReadSaveBuf(&TotalNumberOfMapZones, buffer); + ReadSaveBuf(&NumberOfAudioZones, buffer); VALIDATESAVEBUF(size) } -- cgit v1.2.3