summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/control')
-rw-r--r--src/control/AutoPilot.h4
-rw-r--r--src/control/Garages.h6
-rw-r--r--src/control/OnscreenTimer.h4
-rw-r--r--src/control/PathFind.h9
-rw-r--r--src/control/Phones.h4
-rw-r--r--src/control/Pickups.h4
-rw-r--r--src/control/Replay.h20
-rw-r--r--src/control/SceneEdit.cpp2
-rw-r--r--src/control/Script.cpp10
-rw-r--r--src/control/Script.h4
10 files changed, 32 insertions, 35 deletions
diff --git a/src/control/AutoPilot.h b/src/control/AutoPilot.h
index 1528db46..337a93c1 100644
--- a/src/control/AutoPilot.h
+++ b/src/control/AutoPilot.h
@@ -120,6 +120,4 @@ public:
};
-#ifdef CHECK_STRUCT_SIZES
-static_assert(sizeof(CAutoPilot) == 0x70, "CAutoPilot: error");
-#endif \ No newline at end of file
+VALIDATE_SIZE(CAutoPilot, 0x70);
diff --git a/src/control/Garages.h b/src/control/Garages.h
index 95e7ba5c..00020eb3 100644
--- a/src/control/Garages.h
+++ b/src/control/Garages.h
@@ -75,7 +75,7 @@ public:
CVehicle* RestoreCar();
};
-static_assert(sizeof(CStoredCar) == 0x28, "CStoredCar");
+VALIDATE_SIZE(CStoredCar, 0x28);
#define SWITCH_GARAGE_DISTANCE_CLOSE 40.0f
@@ -172,9 +172,7 @@ class CGarage
friend class CCamera;
};
-#ifdef CHECK_STRUCT_SIZES
-static_assert(sizeof(CGarage) == 140, "CGarage");
-#endif
+VALIDATE_SIZE(CGarage, 140);
class CGarages
{
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 d812ac32..bbfdf7b7 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -42,9 +42,7 @@ struct CPedPathNode
CPedPathNode* next;
};
-#ifdef CHECK_STRUCT_SIZES
-static_assert(sizeof(CPedPathNode) == 0x10, "CPedPathNode: error");
-#endif
+VALIDATE_SIZE(CPedPathNode, 0x10);
class CPedPath {
public:
@@ -225,10 +223,7 @@ public:
void DisplayPathData(void);
};
-
-#ifdef CHECK_STRUCT_SIZES
-static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error");
-#endif
+VALIDATE_SIZE(CPathFind, 0x49bf4);
extern CPathFind ThePaths;
diff --git a/src/control/Phones.h b/src/control/Phones.h
index 01ed370e..14d47ed1 100644
--- a/src/control/Phones.h
+++ b/src/control/Phones.h
@@ -32,9 +32,7 @@ public:
~CPhone() { }
};
-#ifdef CHECK_STRUCT_SIZES
-static_assert(sizeof(CPhone) == 0x34, "CPhone: error");
-#endif
+VALIDATE_SIZE(CPhone, 0x34);
class CPhoneInfo {
public:
diff --git a/src/control/Pickups.h b/src/control/Pickups.h
index f4e5e560..b05f5db7 100644
--- a/src/control/Pickups.h
+++ b/src/control/Pickups.h
@@ -47,9 +47,7 @@ private:
void Remove();
};
-#ifdef CHECK_STRUCT_SIZES
-static_assert(sizeof(CPickup) == 0x1C, "CPickup: error");
-#endif
+VALIDATE_SIZE(CPickup, 0x1C);
struct tPickupMessage
{
diff --git a/src/control/Replay.h b/src/control/Replay.h
index ec39def8..66bee3bf 100644
--- a/src/control/Replay.h
+++ b/src/control/Replay.h
@@ -109,9 +109,7 @@ class CReplay
CVector player_pos;
};
-#ifdef CHECK_STRUCT_SIZES
- static_assert(sizeof(tGeneralPacket) == 88, "tGeneralPacket: error");
-#endif
+ VALIDATE_SIZE(tGeneralPacket, 88);
struct tClockPacket
{
@@ -121,7 +119,7 @@ class CReplay
private:
uint8 __align;
};
- static_assert(sizeof(tClockPacket) == 4, "tClockPacket: error");
+ VALIDATE_SIZE(tClockPacket, 4);
struct tWeatherPacket
{
@@ -130,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
{
@@ -148,7 +146,7 @@ class CReplay
private:
uint8 __align[3];
};
- static_assert(sizeof(tPedHeaderPacket) == 8, "tPedHeaderPacket: error");
+ VALIDATE_SIZE(tPedHeaderPacket, 8);
struct tBulletTracePacket
{
@@ -159,7 +157,7 @@ class CReplay
CVector inf;
CVector sup;
};
- static_assert(sizeof(tBulletTracePacket) == 28, "tBulletTracePacket: error");
+ VALIDATE_SIZE(tBulletTracePacket, 28);
struct tEndOfFramePacket
{
@@ -167,7 +165,7 @@ class CReplay
private:
uint8 __align[3];
};
- static_assert(sizeof(tEndOfFramePacket) == 4, "tEndOfFramePacket: error");
+ VALIDATE_SIZE(tEndOfFramePacket, 4);
struct tPedUpdatePacket
{
@@ -180,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
{
@@ -205,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 c8b4242e..54f4dd3a 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 a274c289..df3a489a 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -11205,7 +11205,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);
@@ -11631,12 +11633,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);
@@ -11662,12 +11668,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 01cad269..acab66cc 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -27,7 +27,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
@@ -78,7 +78,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
{