Fixed typos and made all assert functions optional

This commit is contained in:
bigbossbro08
2020-05-10 21:49:33 +06:00
parent af6e132b37
commit c798e1bacd
73 changed files with 110 additions and 184 deletions

View File

@ -120,6 +120,4 @@ public:
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CAutoPilot) == 0x70, "CAutoPilot: error");
#endif
VALIDATE_SIZE(CAutoPilot, 0x70);

View File

@ -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
{

View File

@ -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");
VALIDATE_SIZE(COnscreenTimer, 0x78);

View File

@ -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;

View File

@ -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:

View File

@ -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
{

View File

@ -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;

View File

@ -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)
{

View File

@ -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);

View File

@ -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
{