summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/control/AutoPilot.h2
-rw-r--r--src/control/Garages.h2
-rw-r--r--src/control/OnscreenTimer.h4
-rw-r--r--src/control/PathFind.h3
-rw-r--r--src/control/Phones.h2
-rw-r--r--src/control/Pickups.h2
-rw-r--r--src/control/Replay.h19
-rw-r--r--src/control/SceneEdit.cpp2
-rw-r--r--src/control/Script.cpp10
-rw-r--r--src/control/Script.h4
10 files changed, 33 insertions, 17 deletions
diff --git a/src/control/AutoPilot.h b/src/control/AutoPilot.h
index 282f1418..25feb72d 100644
--- a/src/control/AutoPilot.h
+++ b/src/control/AutoPilot.h
@@ -133,3 +133,5 @@ public:
float GetCruiseSpeed(void) { return m_nCruiseSpeed * m_fCruiseSpeedMultiplier; }
};
+
+VALIDATE_SIZE(CAutoPilot, 0x70);
diff --git a/src/control/Garages.h b/src/control/Garages.h
index 6acbcc63..c5bede2b 100644
--- a/src/control/Garages.h
+++ b/src/control/Garages.h
@@ -87,7 +87,7 @@ public:
CVehicle* RestoreCar();
};
-static_assert(sizeof(CStoredCar) == 0x28, "CStoredCar");
+VALIDATE_SIZE(CStoredCar, 0x28);
#define SWITCH_GARAGE_DISTANCE_CLOSE 40.0f
diff --git a/src/control/OnscreenTimer.h b/src/control/OnscreenTimer.h
index fb139266..3ef7764a 100644
--- a/src/control/OnscreenTimer.h
+++ b/src/control/OnscreenTimer.h
@@ -26,7 +26,7 @@ public:
void ProcessForDisplayCounter();
};
-static_assert(sizeof(COnscreenTimerEntry) == 0x74, "COnscreenTimerEntry: error");
+VALIDATE_SIZE(COnscreenTimerEntry, 0x74);
class COnscreenTimer
{
@@ -46,4 +46,4 @@ public:
void AddClock(uint32 offset, char* text);
};
-static_assert(sizeof(COnscreenTimer) == 0x78, "COnscreenTimer: error"); \ No newline at end of file
+VALIDATE_SIZE(COnscreenTimer, 0x78);
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index 5f5de3e1..7abc455a 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -38,7 +38,8 @@ struct CPedPathNode
CPedPathNode* prev;
CPedPathNode* next;
};
-static_assert(sizeof(CPedPathNode) == 0x10, "CPedPathNode: error");
+
+VALIDATE_SIZE(CPedPathNode, 0x10);
class CPedPath {
public:
diff --git a/src/control/Phones.h b/src/control/Phones.h
index 7fbf403f..14d47ed1 100644
--- a/src/control/Phones.h
+++ b/src/control/Phones.h
@@ -32,7 +32,7 @@ public:
~CPhone() { }
};
-static_assert(sizeof(CPhone) == 0x34, "CPhone: error");
+VALIDATE_SIZE(CPhone, 0x34);
class CPhoneInfo {
public:
diff --git a/src/control/Pickups.h b/src/control/Pickups.h
index 0c617f9e..51c6ab64 100644
--- a/src/control/Pickups.h
+++ b/src/control/Pickups.h
@@ -51,7 +51,7 @@ private:
void Remove();
};
-static_assert(sizeof(CPickup) == 0x1C, "CPickup: error");
+VALIDATE_SIZE(CPickup, 0x1C);
struct tPickupMessage
{
diff --git a/src/control/Replay.h b/src/control/Replay.h
index 6a07e593..09cf601e 100644
--- a/src/control/Replay.h
+++ b/src/control/Replay.h
@@ -108,7 +108,8 @@ class CReplay
CMatrix camera_pos;
CVector player_pos;
};
- static_assert(sizeof(tGeneralPacket) == 88, "tGeneralPacket: error");
+
+ VALIDATE_SIZE(tGeneralPacket, 88);
struct tClockPacket
{
@@ -118,7 +119,7 @@ class CReplay
private:
uint8 __align;
};
- static_assert(sizeof(tClockPacket) == 4, "tClockPacket: error");
+ VALIDATE_SIZE(tClockPacket, 4);
struct tWeatherPacket
{
@@ -127,14 +128,14 @@ class CReplay
uint8 new_weather;
float interpolation;
};
- static_assert(sizeof(tWeatherPacket) == 8, "tWeatherPacket: error");
+ VALIDATE_SIZE(tWeatherPacket, 8);
struct tTimerPacket
{
uint8 type;
uint32 timer;
};
- static_assert(sizeof(tTimerPacket) == 8, "tTimerPacket: error");
+ VALIDATE_SIZE(tTimerPacket, 8);
struct tPedHeaderPacket
{
@@ -145,7 +146,7 @@ class CReplay
private:
uint8 __align[3];
};
- static_assert(sizeof(tPedHeaderPacket) == 8, "tPedHeaderPacket: error");
+ VALIDATE_SIZE(tPedHeaderPacket, 8);
struct tBulletTracePacket
{
@@ -156,7 +157,7 @@ class CReplay
CVector inf;
CVector sup;
};
- static_assert(sizeof(tBulletTracePacket) == 28, "tBulletTracePacket: error");
+ VALIDATE_SIZE(tBulletTracePacket, 28);
struct tEndOfFramePacket
{
@@ -164,7 +165,7 @@ class CReplay
private:
uint8 __align[3];
};
- static_assert(sizeof(tEndOfFramePacket) == 4, "tEndOfFramePacket: error");
+ VALIDATE_SIZE(tEndOfFramePacket, 4);
struct tPedUpdatePacket
{
@@ -177,7 +178,7 @@ class CReplay
int8 assoc_group_id;
uint8 weapon_model;
};
- static_assert(sizeof(tPedUpdatePacket) == 40, "tPedUpdatePacket: error");
+ VALIDATE_SIZE(tPedUpdatePacket, 40);
struct tVehicleUpdatePacket
{
@@ -202,7 +203,7 @@ class CReplay
uint8 primary_color;
uint8 secondary_color;
};
- static_assert(sizeof(tVehicleUpdatePacket) == 48, "tVehicleUpdatePacket: error");
+ VALIDATE_SIZE(tVehicleUpdatePacket, 48);
private:
static uint8 Mode;
diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp
index bdb93f33..1b6292b8 100644
--- a/src/control/SceneEdit.cpp
+++ b/src/control/SceneEdit.cpp
@@ -68,7 +68,9 @@ static const char* pCommandStrings[] = {
"Save Movie", "Load Movie", "Play Movie", "END"
};
+#ifdef CHECK_STRUCT_SIZES
static_assert(ARRAY_SIZE(pCommandStrings) == CSceneEdit::MOVIE_TOTAL_COMMANDS, "Scene edit: not all commands have names");
+#endif
static int32 NextValidModelId(int32 mi, int32 step)
{
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 045a81fe..f6d5b2f0 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -11641,7 +11641,9 @@ INITSAVEBUF
WriteSaveBuf(buf, varSpace);
for (uint32 i = 0; i < varSpace; i++)
WriteSaveBuf(buf, ScriptSpace[i]);
+#ifdef CHECK_STRUCT_SIZES
static_assert(SCRIPT_DATA_SIZE == 968, "CTheScripts::SaveAllScripts");
+#endif
uint32 script_data_size = SCRIPT_DATA_SIZE;
WriteSaveBuf(buf, script_data_size);
WriteSaveBuf(buf, OnAMissionFlag);
@@ -12067,12 +12069,16 @@ void CRunningScript::Save(uint8*& buf)
for (int i = 0; i < 8; i++)
WriteSaveBuf<char>(buf, m_abScriptName[i]);
WriteSaveBuf<uint32>(buf, m_nIp);
+#ifdef CHECK_STRUCT_SIZES
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
+#endif
for (int i = 0; i < MAX_STACK_DEPTH; i++)
WriteSaveBuf<uint32>(buf, m_anStack[i]);
WriteSaveBuf<uint16>(buf, m_nStackPointer);
SkipSaveBuf(buf, 2);
+#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
+#endif
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
WriteSaveBuf<bool>(buf, m_bCondResult);
@@ -12098,12 +12104,16 @@ void CRunningScript::Load(uint8*& buf)
for (int i = 0; i < 8; i++)
m_abScriptName[i] = ReadSaveBuf<char>(buf);
m_nIp = ReadSaveBuf<uint32>(buf);
+#ifdef CHECK_STRUCT_SIZES
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
+#endif
for (int i = 0; i < MAX_STACK_DEPTH; i++)
m_anStack[i] = ReadSaveBuf<uint32>(buf);
m_nStackPointer = ReadSaveBuf<uint16>(buf);
SkipSaveBuf(buf, 2);
+#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
+#endif
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
m_bCondResult = ReadSaveBuf<bool>(buf);
diff --git a/src/control/Script.h b/src/control/Script.h
index fe6a2f31..9931f13e 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -28,7 +28,7 @@ struct intro_script_rectangle
~intro_script_rectangle() { }
};
-static_assert(sizeof(intro_script_rectangle) == 0x18, "Script.h: error");
+VALIDATE_SIZE(intro_script_rectangle, 0x18);
enum {
SCRIPT_TEXT_MAX_LENGTH = 500
@@ -79,7 +79,7 @@ struct intro_text_line
}
};
-static_assert(sizeof(intro_text_line) == 0x414, "Script.h: error");
+VALIDATE_SIZE(intro_text_line, 0x414);
struct script_sphere_struct
{