summaryrefslogtreecommitdiffstats
path: root/src/vehicles
diff options
context:
space:
mode:
Diffstat (limited to 'src/vehicles')
-rw-r--r--src/vehicles/Automobile.cpp3
-rw-r--r--src/vehicles/Boat.cpp1
-rw-r--r--src/vehicles/CarGen.cpp20
-rw-r--r--src/vehicles/Cranes.cpp7
-rw-r--r--src/vehicles/Vehicle.cpp65
5 files changed, 53 insertions, 43 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index c29c0536..7be6ed0b 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -45,6 +45,7 @@
#include "Object.h"
#include "Automobile.h"
#include "Wanted.h"
+#include "SaveBuf.h"
bool bAllCarCheat; // unused
@@ -4724,7 +4725,7 @@ void
CAutomobile::Load(uint8*& buf)
{
CVehicle::Load(buf);
- Damage = ReadSaveBuf<CDamageManager>(buf);
+ ReadSaveBuf(&Damage, buf);
SkipSaveBuf(buf, 800 - sizeof(CDamageManager));
SetupDamageAfterLoad();
}
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 4bbbadbd..bbe17f0b 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -19,6 +19,7 @@
#include "Pools.h"
#include "Pad.h"
#include "Boat.h"
+#include "SaveBuf.h"
#define INVALID_ORIENTATION (-9999.99f)
diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp
index 7524444b..22b2fc60 100644
--- a/src/vehicles/CarGen.cpp
+++ b/src/vehicles/CarGen.cpp
@@ -13,6 +13,7 @@
#include "Timer.h"
#include "Vehicle.h"
#include "World.h"
+#include "SaveBuf.h"
uint8 CTheCarGenerators::ProcessCounter;
uint32 CTheCarGenerators::NumOfCarGenerators;
@@ -254,14 +255,17 @@ void CTheCarGenerators::LoadAllCarGenerators(uint8* buffer, uint32 size)
Init();
INITSAVEBUF
CheckSaveHeader(buffer, 'C','G','N','\0', size - SAVE_HEADER_SIZE);
- assert(ReadSaveBuf<uint32>(buffer) == nGeneralDataSize);
- NumOfCarGenerators = ReadSaveBuf<uint32>(buffer);
- CurrentActiveCount = ReadSaveBuf<uint32>(buffer);
- ProcessCounter = ReadSaveBuf<uint8>(buffer);
- GenerateEvenIfPlayerIsCloseCounter = ReadSaveBuf<uint8>(buffer);
- ReadSaveBuf<int16>(buffer); // alignment
- assert(ReadSaveBuf<uint32>(buffer) == sizeof(CarGeneratorArray));
+ uint32 tmp;
+ ReadSaveBuf(&tmp, buffer);
+ assert(tmp == nGeneralDataSize);
+ ReadSaveBuf(&NumOfCarGenerators, buffer);
+ ReadSaveBuf(&CurrentActiveCount, buffer);
+ ReadSaveBuf(&ProcessCounter, buffer);
+ ReadSaveBuf(&GenerateEvenIfPlayerIsCloseCounter, buffer);
+ SkipSaveBuf(buffer, 2);
+ ReadSaveBuf(&tmp, buffer);
+ assert(tmp == sizeof(CarGeneratorArray));
for (int i = 0; i < NUM_CARGENS; i++)
- CarGeneratorArray[i] = ReadSaveBuf<CCarGenerator>(buffer);
+ ReadSaveBuf(&CarGeneratorArray[i], buffer);
VALIDATESAVEBUF(size)
}
diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp
index 0c7913af..0f1b8b4c 100644
--- a/src/vehicles/Cranes.cpp
+++ b/src/vehicles/Cranes.cpp
@@ -11,6 +11,7 @@
#include "Replay.h"
#include "Object.h"
#include "World.h"
+#include "SaveBuf.h"
#define MAX_DISTANCE_TO_FIND_CRANE (10.0f)
#define CRANE_UPDATE_RADIUS (300.0f)
@@ -653,10 +654,10 @@ void CCranes::Load(uint8* buf, uint32 size)
{
INITSAVEBUF
- NumCranes = ReadSaveBuf<int32>(buf);
- CarsCollectedMilitaryCrane = ReadSaveBuf<uint32>(buf);
+ ReadSaveBuf(&NumCranes, buf);
+ ReadSaveBuf(&CarsCollectedMilitaryCrane, buf);
for (int i = 0; i < NUM_CRANES; i++)
- aCranes[i] = ReadSaveBuf<CCrane>(buf);
+ ReadSaveBuf(&aCranes[i], buf);
for (int i = 0; i < NUM_CRANES; i++) {
CCrane *pCrane = &aCranes[i];
if (pCrane->m_pCraneEntity != nil)
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 8885485d..8112f0fe 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -18,6 +18,7 @@
#include "Radar.h"
#include "Fire.h"
#include "Darkel.h"
+#include "SaveBuf.h"
bool CVehicle::bWheelsOnlyCheat;
bool CVehicle::bAllDodosCheat;
@@ -1323,43 +1324,44 @@ CVehicle::Load(uint8*& buf)
{
CMatrix tmp;
SkipSaveBuf(buf, 4);
- tmp.GetRight().x = ReadSaveBuf<float>(buf);
- tmp.GetRight().y = ReadSaveBuf<float>(buf);
- tmp.GetRight().z = ReadSaveBuf<float>(buf);
+ ReadSaveBuf(&tmp.GetRight().x, buf);
+ ReadSaveBuf(&tmp.GetRight().y, buf);
+ ReadSaveBuf(&tmp.GetRight().z, buf);
SkipSaveBuf(buf, 4);
- tmp.GetForward().x = ReadSaveBuf<float>(buf);
- tmp.GetForward().y = ReadSaveBuf<float>(buf);
- tmp.GetForward().z = ReadSaveBuf<float>(buf);
+ ReadSaveBuf(&tmp.GetForward().x, buf);
+ ReadSaveBuf(&tmp.GetForward().y, buf);
+ ReadSaveBuf(&tmp.GetForward().z, buf);
SkipSaveBuf(buf, 4);
- tmp.GetUp().x = ReadSaveBuf<float>(buf);
- tmp.GetUp().y = ReadSaveBuf<float>(buf);
- tmp.GetUp().z = ReadSaveBuf<float>(buf);
+ ReadSaveBuf(&tmp.GetUp().x, buf);
+ ReadSaveBuf(&tmp.GetUp().y, buf);
+ ReadSaveBuf(&tmp.GetUp().z, buf);
SkipSaveBuf(buf, 4);
- tmp.GetPosition().x = ReadSaveBuf<float>(buf);
- tmp.GetPosition().y = ReadSaveBuf<float>(buf);
- tmp.GetPosition().z = ReadSaveBuf<float>(buf);
+ ReadSaveBuf(&tmp.GetPosition().x, buf);
+ ReadSaveBuf(&tmp.GetPosition().y, buf);
+ ReadSaveBuf(&tmp.GetPosition().z, buf);
m_matrix = tmp;
SkipSaveBuf(buf, 16);
LoadEntityFlags(buf);
SkipSaveBuf(buf, 212);
AutoPilot.Load(buf);
- m_currentColour1 = ReadSaveBuf<int8>(buf);
- m_currentColour2 = ReadSaveBuf<int8>(buf);
+ ReadSaveBuf(&m_currentColour1, buf);
+ ReadSaveBuf(&m_currentColour2, buf);
SkipSaveBuf(buf, 2);
- m_nAlarmState = ReadSaveBuf<int16>(buf);
+ ReadSaveBuf(&m_nAlarmState, buf);
SkipSaveBuf(buf, 43);
- m_nNumMaxPassengers = ReadSaveBuf<int8>(buf);
+ ReadSaveBuf(&m_nNumMaxPassengers, buf);
SkipSaveBuf(buf, 2);
- field_1D0[0] = ReadSaveBuf<float>(buf);
- field_1D0[1] = ReadSaveBuf<float>(buf);
- field_1D0[2] = ReadSaveBuf<float>(buf);
- field_1D0[3] = ReadSaveBuf<float>(buf);
+ ReadSaveBuf(&field_1D0[0], buf);
+ ReadSaveBuf(&field_1D0[1], buf);
+ ReadSaveBuf(&field_1D0[2], buf);
+ ReadSaveBuf(&field_1D0[3], buf);
SkipSaveBuf(buf, 8);
- m_fSteerAngle = ReadSaveBuf<float>(buf);
- m_fGasPedal = ReadSaveBuf<float>(buf);
- m_fBrakePedal = ReadSaveBuf<float>(buf);
- VehicleCreatedBy = ReadSaveBuf<uint8>(buf);
- uint8 flags = ReadSaveBuf<uint8>(buf);
+ ReadSaveBuf(&m_fSteerAngle, buf);
+ ReadSaveBuf(&m_fGasPedal, buf);
+ ReadSaveBuf(&m_fBrakePedal, buf);
+ ReadSaveBuf(&VehicleCreatedBy, buf);
+ uint8 flags;
+ ReadSaveBuf(&flags, buf);
bIsLawEnforcer = !!(flags & BIT(0));
bIsLocked = !!(flags & BIT(3));
bEngineOn = !!(flags & BIT(4));
@@ -1367,16 +1369,17 @@ CVehicle::Load(uint8*& buf)
bLightsOn = !!(flags & BIT(6));
bFreebies = !!(flags & BIT(7));
SkipSaveBuf(buf, 10);
- m_fHealth = ReadSaveBuf<float>(buf);
- m_nCurrentGear = ReadSaveBuf<uint8>(buf);
+ ReadSaveBuf(&m_fHealth, buf);
+ ReadSaveBuf(&m_nCurrentGear, buf);
SkipSaveBuf(buf, 3);
- m_fChangeGearTime = ReadSaveBuf<float>(buf);
+ ReadSaveBuf(&m_fChangeGearTime, buf);
SkipSaveBuf(buf, 4);
- m_nTimeOfDeath = ReadSaveBuf<uint32>(buf);
+ ReadSaveBuf(&m_nTimeOfDeath, buf);
SkipSaveBuf(buf, 2);
- m_nBombTimer = ReadSaveBuf<int16>(buf);
+ ReadSaveBuf(&m_nBombTimer, buf);
SkipSaveBuf(buf, 12);
- m_nDoorLock = (eCarLock)ReadSaveBuf<int8>(buf);
+ ReadSaveBuf(&flags, buf);
+ m_nDoorLock = (eCarLock)flags;
SkipSaveBuf(buf, 99);
}
#endif