From af6e132b37e8b7e89e4c0c7a52e5bb81e4b1b9a8 Mon Sep 17 00:00:00 2001 From: bigbossbro08 Date: Sun, 10 May 2020 19:54:37 +0600 Subject: defined out asserts. --- src/animation/AnimBlendAssociation.h | 3 +++ src/animation/AnimBlendHierarchy.h | 3 +++ src/animation/AnimBlendNode.h | 3 +++ src/audio/AudioCollision.h | 6 +++++- src/audio/AudioManager.h | 4 ++++ src/control/AutoPilot.h | 5 ++++- src/control/Garages.h | 2 ++ src/control/PathFind.h | 7 +++++++ src/control/Phones.h | 2 ++ src/control/Pickups.h | 2 ++ src/control/Replay.h | 3 +++ src/core/Camera.h | 6 ++++++ src/core/CdStream.cpp | 3 +++ src/core/CdStream.h | 3 ++- src/core/Placeable.h | 5 ++++- src/core/PlayerInfo.h | 3 +++ src/core/Wanted.h | 2 ++ src/core/World.h | 4 ++++ src/core/common.h | 4 ++++ src/entities/Building.h | 3 +++ src/entities/Dummy.h | 3 +++ src/entities/Entity.h | 3 +++ src/entities/Physical.h | 3 +++ src/entities/Treadable.h | 3 +++ src/modelinfo/BaseModelInfo.h | 2 ++ src/modelinfo/ClumpModelInfo.h | 3 +++ src/modelinfo/SimpleModelInfo.h | 3 +++ src/modelinfo/TimeModelInfo.h | 3 +++ src/modelinfo/VehicleModelInfo.h | 3 +++ src/objects/DummyObject.h | 3 +++ src/objects/Object.h | 3 +++ src/peds/DummyPed.h | 3 +++ src/peds/PedIK.h | 3 +++ src/render/2dEffect.h | 3 +++ src/render/Coronas.h | 3 +++ src/render/Glass.h | 2 ++ src/render/Particle.h | 4 +++- src/render/ParticleMgr.h | 6 +++++- src/render/Shadows.h | 11 +++++++++++ src/skel/win/win.cpp | 2 ++ src/text/Text.h | 3 +++ src/vehicles/Automobile.h | 2 ++ src/vehicles/Boat.h | 2 ++ src/vehicles/Cranes.h | 2 ++ src/vehicles/Heli.h | 3 +++ src/vehicles/Plane.h | 3 +++ src/vehicles/Train.h | 3 +++ src/vehicles/Vehicle.h | 2 ++ 48 files changed, 156 insertions(+), 6 deletions(-) diff --git a/src/animation/AnimBlendAssociation.h b/src/animation/AnimBlendAssociation.h index dd4c7a34..4f3be016 100644 --- a/src/animation/AnimBlendAssociation.h +++ b/src/animation/AnimBlendAssociation.h @@ -84,4 +84,7 @@ public: return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link)); } }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CAnimBlendAssociation) == 0x40, "CAnimBlendAssociation: error"); +#endif \ No newline at end of file diff --git a/src/animation/AnimBlendHierarchy.h b/src/animation/AnimBlendHierarchy.h index 917e1585..1bf687cc 100644 --- a/src/animation/AnimBlendHierarchy.h +++ b/src/animation/AnimBlendHierarchy.h @@ -24,4 +24,7 @@ public: void Uncompress(void); void RemoveUncompressedData(void); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CAnimBlendHierarchy) == 0x28, "CAnimBlendHierarchy: error"); +#endif \ No newline at end of file diff --git a/src/animation/AnimBlendNode.h b/src/animation/AnimBlendNode.h index 361a4134..46f2fee4 100644 --- a/src/animation/AnimBlendNode.h +++ b/src/animation/AnimBlendNode.h @@ -26,4 +26,7 @@ public: void GetCurrentTranslation(CVector &trans, float weight); void GetEndTranslation(CVector &trans, float weight); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CAnimBlendNode) == 0x1C, "CAnimBlendNode: error"); +#endif \ No newline at end of file diff --git a/src/audio/AudioCollision.h b/src/audio/AudioCollision.h index 324bab0e..e8711f9a 100644 --- a/src/audio/AudioCollision.h +++ b/src/audio/AudioCollision.h @@ -20,7 +20,9 @@ public: // no methods }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(cAudioCollision) == 40, "cAudioCollision: error"); +#endif class cAudioCollisionManager { @@ -35,4 +37,6 @@ public: void AddCollisionToRequestedQueue(); }; -static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error"); \ No newline at end of file +#ifdef CHECK_STRUCT_SIZES +static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error"); +#endif \ No newline at end of file diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 0d0c5d91..5f00eac4 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -52,7 +52,9 @@ public: uint8 m_AudioEvents; }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error"); +#endif class tPedComment { @@ -135,7 +137,9 @@ public: float m_fVelocityChange; }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(cVehicleParams) == 0x18, "cVehicleParams: error"); +#endif enum { /* diff --git a/src/control/AutoPilot.h b/src/control/AutoPilot.h index 345f4cb4..1528db46 100644 --- a/src/control/AutoPilot.h +++ b/src/control/AutoPilot.h @@ -119,4 +119,7 @@ public: #endif }; -static_assert(sizeof(CAutoPilot) == 0x70, "CAutoPilot: error"); \ No newline at end of file + +#ifdef CHECK_STRUCT_SIZES +static_assert(sizeof(CAutoPilot) == 0x70, "CAutoPilot: error"); +#endif \ No newline at end of file diff --git a/src/control/Garages.h b/src/control/Garages.h index 3105f72d..95e7ba5c 100644 --- a/src/control/Garages.h +++ b/src/control/Garages.h @@ -172,7 +172,9 @@ class CGarage friend class CCamera; }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CGarage) == 140, "CGarage"); +#endif class CGarages { diff --git a/src/control/PathFind.h b/src/control/PathFind.h index 8049ea52..d812ac32 100644 --- a/src/control/PathFind.h +++ b/src/control/PathFind.h @@ -41,7 +41,10 @@ struct CPedPathNode CPedPathNode* prev; CPedPathNode* next; }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CPedPathNode) == 0x10, "CPedPathNode: error"); +#endif class CPedPath { public: @@ -221,7 +224,11 @@ public: void DisplayPathData(void); }; + + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error"); +#endif extern CPathFind ThePaths; diff --git a/src/control/Phones.h b/src/control/Phones.h index 7fbf403f..01ed370e 100644 --- a/src/control/Phones.h +++ b/src/control/Phones.h @@ -32,7 +32,9 @@ public: ~CPhone() { } }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CPhone) == 0x34, "CPhone: error"); +#endif class CPhoneInfo { public: diff --git a/src/control/Pickups.h b/src/control/Pickups.h index 11da5f54..f4e5e560 100644 --- a/src/control/Pickups.h +++ b/src/control/Pickups.h @@ -47,7 +47,9 @@ private: void Remove(); }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CPickup) == 0x1C, "CPickup: error"); +#endif struct tPickupMessage { diff --git a/src/control/Replay.h b/src/control/Replay.h index bf70a28a..ec39def8 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -108,7 +108,10 @@ class CReplay CMatrix camera_pos; CVector player_pos; }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(tGeneralPacket) == 88, "tGeneralPacket: error"); +#endif struct tClockPacket { diff --git a/src/core/Camera.h b/src/core/Camera.h index 51138f99..d69b1be4 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -260,9 +260,12 @@ public: void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_FollowCar_SA(const CVector &CameraTarget, float TargetOrientation, float, float); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size"); static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error"); static_assert(offsetof(CCam, Front) == 0x140, "CCam: error"); +#endif class CCamPathSplines { @@ -637,6 +640,8 @@ uint32 unknown; // some counter having to do with music bool IsSphereVisible(const CVector ¢er, float radius); bool IsBoxVisible(RwV3d *box, const CMatrix *mat); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(offsetof(CCamera, DistanceToWater) == 0xe4, "CCamera: error"); static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error"); static_assert(offsetof(CCamera, WorldViewerBeingUsed) == 0x75, "CCamera: error"); @@ -650,6 +655,7 @@ static_assert(offsetof(CCamera, m_PreviousCameraPosition) == 0x6B0, "CCamera: er static_assert(offsetof(CCamera, m_vecCutSceneOffset) == 0x6F8, "CCamera: error"); static_assert(offsetof(CCamera, m_arrPathArray) == 0x7a8, "CCamera: error"); static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size"); +#endif extern CCamera TheCamera; diff --git a/src/core/CdStream.cpp b/src/core/CdStream.cpp index ea79fb9a..3b9eaac5 100644 --- a/src/core/CdStream.cpp +++ b/src/core/CdStream.cpp @@ -22,7 +22,10 @@ struct CdReadInfo HANDLE hFile; OVERLAPPED Overlapped; }; + +#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(CdReadInfo, 0x30); +#endif char gCdImageNames[MAX_CDIMAGES+1][64]; int32 gNumImages; diff --git a/src/core/CdStream.h b/src/core/CdStream.h index 9ef71b65..ba74be31 100644 --- a/src/core/CdStream.h +++ b/src/core/CdStream.h @@ -25,8 +25,9 @@ struct Queue int32 size; }; +#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(Queue, 0x10); - +#endif void CdStreamInitThread(void); void CdStreamInit(int32 numChannels); diff --git a/src/core/Placeable.h b/src/core/Placeable.h index 7e858283..110a1542 100644 --- a/src/core/Placeable.h +++ b/src/core/Placeable.h @@ -31,4 +31,7 @@ public: bool IsWithinArea(float x1, float y1, float x2, float y2); bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2); }; -static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error"); \ No newline at end of file + +#ifdef CHECK_STRUCT_SIZES +static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error"); +#endif \ No newline at end of file diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h index e970e42d..ae089032 100644 --- a/src/core/PlayerInfo.h +++ b/src/core/PlayerInfo.h @@ -80,4 +80,7 @@ public: ~CPlayerInfo() { }; }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error"); +#endif diff --git a/src/core/Wanted.h b/src/core/Wanted.h index e3e407b0..802c3673 100644 --- a/src/core/Wanted.h +++ b/src/core/Wanted.h @@ -54,4 +54,6 @@ public: static void SetMaximumWantedLevel(int32 level); }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CWanted) == 0x204, "CWanted: error"); +#endif diff --git a/src/core/World.h b/src/core/World.h index ab3f0192..6fc6681d 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -45,7 +45,11 @@ class CSector public: CPtrList m_lists[NUMSECTORENTITYLISTS]; }; + + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CSector) == 0x28, "CSector: error"); +#endif class CEntity; struct CColPoint; diff --git a/src/core/common.h b/src/core/common.h index ff8580a1..41773877 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -226,7 +226,11 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con #define _TODO(x) #define _TODOCONST(x) (x) +#ifdef CHECK_STRUCT_SIZES #define VALIDATE_SIZE(struc, size) static_assert(sizeof(struc) == size, "Invalid structure size of " #struc) +#else +#define VALIDATE_SIZE(struc, size) +#endif #define VALIDATE_OFFSET(struc, member, offset) static_assert(offsetof(struc, member) == offset, "The offset of " #member " in " #struc " is not " #offset "...") #define PERCENT(x, p) ((float(x) * (float(p) / 100.0f))) diff --git a/src/entities/Building.h b/src/entities/Building.h index 7b837f46..50818189 100644 --- a/src/entities/Building.h +++ b/src/entities/Building.h @@ -16,4 +16,7 @@ public: virtual bool GetIsATreadable(void) { return false; } }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CBuilding) == 0x64, "CBuilding: error"); +#endif diff --git a/src/entities/Dummy.h b/src/entities/Dummy.h index fcfd23fb..de0e448b 100644 --- a/src/entities/Dummy.h +++ b/src/entities/Dummy.h @@ -15,4 +15,7 @@ public: static void *operator new(size_t); static void operator delete(void*, size_t); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CDummy) == 0x68, "CDummy: error"); +#endif diff --git a/src/entities/Entity.h b/src/entities/Entity.h index 330fde69..18254ae4 100644 --- a/src/entities/Entity.h +++ b/src/entities/Entity.h @@ -172,4 +172,7 @@ public: static void AddSteamsFromGround(CPtrList& list); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CEntity) == 0x64, "CEntity: error"); +#endif \ No newline at end of file diff --git a/src/entities/Physical.h b/src/entities/Physical.h index b47d556e..c9b7402b 100644 --- a/src/entities/Physical.h +++ b/src/entities/Physical.h @@ -160,4 +160,7 @@ public: bool CheckCollision(void); bool CheckCollision_SimpleCar(void); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CPhysical) == 0x128, "CPhysical: error"); +#endif diff --git a/src/entities/Treadable.h b/src/entities/Treadable.h index 9e4de59a..272b2d4b 100644 --- a/src/entities/Treadable.h +++ b/src/entities/Treadable.h @@ -12,4 +12,7 @@ public: bool GetIsATreadable(void) { return true; } }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CTreadable) == 0x94, "CTreadable: error"); +#endif diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h index fdf1efb6..ce42cb3a 100644 --- a/src/modelinfo/BaseModelInfo.h +++ b/src/modelinfo/BaseModelInfo.h @@ -70,4 +70,6 @@ public: uint16 GetNumRefs() const { return m_refCount; } }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error"); +#endif diff --git a/src/modelinfo/ClumpModelInfo.h b/src/modelinfo/ClumpModelInfo.h index c37a468a..a4ba2c9e 100644 --- a/src/modelinfo/ClumpModelInfo.h +++ b/src/modelinfo/ClumpModelInfo.h @@ -50,4 +50,7 @@ public: static RwFrame *FillFrameArrayCB(RwFrame *frame, void *data); static RwFrame *GetFrameFromId(RpClump *clump, int32 id); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CClumpModelInfo) == 0x34, "CClumpModelInfo: error"); +#endif diff --git a/src/modelinfo/SimpleModelInfo.h b/src/modelinfo/SimpleModelInfo.h index 8c4173e9..65ff8c52 100644 --- a/src/modelinfo/SimpleModelInfo.h +++ b/src/modelinfo/SimpleModelInfo.h @@ -49,4 +49,7 @@ public: void SetRelatedModel(CSimpleModelInfo *m){ m_atomics[2] = (RpAtomic*)m; } }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CSimpleModelInfo) == 0x4C, "CSimpleModelInfo: error"); +#endif diff --git a/src/modelinfo/TimeModelInfo.h b/src/modelinfo/TimeModelInfo.h index f8b7c8ff..cbe171e0 100644 --- a/src/modelinfo/TimeModelInfo.h +++ b/src/modelinfo/TimeModelInfo.h @@ -17,4 +17,7 @@ public: void SetOtherTimeModel(int32 other) { m_otherTimeModelID = other; } CTimeModelInfo *FindOtherTimeModel(void); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error"); +#endif \ No newline at end of file diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index 6946c5c1..160c846b 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -123,4 +123,7 @@ public: static int GetMaximumNumberOfPassengersFromNumberOfDoors(int id); static void SetComponentsToUse(int8 c1, int8 c2) { ms_compsToUse[0] = c1; ms_compsToUse[1] = c2; } }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CVehicleModelInfo) == 0x1F8, "CVehicleModelInfo: error"); +#endif diff --git a/src/objects/DummyObject.h b/src/objects/DummyObject.h index d4dce609..8a0913c5 100644 --- a/src/objects/DummyObject.h +++ b/src/objects/DummyObject.h @@ -10,4 +10,7 @@ public: CDummyObject(void) {} CDummyObject(CObject *obj); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CDummyObject) == 0x68, "CDummyObject: error"); +#endif \ No newline at end of file diff --git a/src/objects/Object.h b/src/objects/Object.h index 80b9015c..ff4c896e 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -97,4 +97,7 @@ public: static void DeleteAllTempObjects(); static void DeleteAllTempObjectsInArea(CVector point, float fRadius); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CObject) == 0x198, "CObject: error"); +#endif diff --git a/src/peds/DummyPed.h b/src/peds/DummyPed.h index af633dc4..5bb72d87 100644 --- a/src/peds/DummyPed.h +++ b/src/peds/DummyPed.h @@ -8,4 +8,7 @@ class CDummyPed : CDummy int32 pedType; int32 unknown; }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CDummyPed) == 0x70, "CDummyPed: error"); +#endif \ No newline at end of file diff --git a/src/peds/PedIK.h b/src/peds/PedIK.h index fd9e4702..566193d6 100644 --- a/src/peds/PedIK.h +++ b/src/peds/PedIK.h @@ -64,4 +64,7 @@ public: bool LookAtPosition(CVector const& pos); bool RestoreLookAt(void); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CPedIK) == 0x28, "CPedIK: error"); +#endif diff --git a/src/render/2dEffect.h b/src/render/2dEffect.h index a24a3f4f..8c583799 100644 --- a/src/render/2dEffect.h +++ b/src/render/2dEffect.h @@ -89,4 +89,7 @@ public: } } }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(C2dEffect) == 0x34, "C2dEffect: error"); +#endif \ No newline at end of file diff --git a/src/render/Coronas.h b/src/render/Coronas.h index 4b49e40e..d2e79079 100644 --- a/src/render/Coronas.h +++ b/src/render/Coronas.h @@ -38,7 +38,10 @@ struct CRegisteredCorona void Update(void); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CRegisteredCorona) == 0x80, "CRegisteredCorona: error"); +#endif class CCoronas { diff --git a/src/render/Glass.h b/src/render/Glass.h index 51c5aae9..0c715c27 100644 --- a/src/render/Glass.h +++ b/src/render/Glass.h @@ -21,7 +21,9 @@ public: void Render(void); }; +#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(CFallingGlassPane, 0x70); +#endif enum { diff --git a/src/render/Particle.h b/src/render/Particle.h index b71dc717..ed1528d2 100644 --- a/src/render/Particle.h +++ b/src/render/Particle.h @@ -91,4 +91,6 @@ public: static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix); }; -VALIDATE_SIZE(CParticle, 0x68); \ No newline at end of file +#ifdef CHECK_STRUCT_SIZES +VALIDATE_SIZE(CParticle, 0x68); +#endif \ No newline at end of file diff --git a/src/render/ParticleMgr.h b/src/render/ParticleMgr.h index 70845a56..42e3f132 100644 --- a/src/render/ParticleMgr.h +++ b/src/render/ParticleMgr.h @@ -64,8 +64,10 @@ struct tParticleSystemData RwRaster **m_ppRaster; CParticle *m_pParticles; }; -VALIDATE_SIZE(tParticleSystemData, 0x88); +#ifdef CHECK_STRUCT_SIZES +VALIDATE_SIZE(tParticleSystemData, 0x88); +#endif class cParticleSystemMgr { @@ -125,6 +127,8 @@ public: void RangeCheck(tParticleSystemData *pData) { } }; +#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(cParticleSystemMgr, 0x2420); +#endif extern cParticleSystemMgr mod_ParticleSystemManager; \ No newline at end of file diff --git a/src/render/Shadows.h b/src/render/Shadows.h index 39be343e..8e89024d 100644 --- a/src/render/Shadows.h +++ b/src/render/Shadows.h @@ -51,7 +51,10 @@ public: CStoredShadow() { } }; + +#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(CStoredShadow, 0x30); +#endif class CPolyBunch { @@ -65,7 +68,10 @@ public: CPolyBunch() { } }; + +#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(CPolyBunch, 0x6C); +#endif class CStaticShadow { @@ -93,7 +99,10 @@ public: void Free(); }; + +#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(CStaticShadow, 0x40); +#endif class CPermanentShadow { @@ -115,7 +124,9 @@ public: CPermanentShadow() { } }; +#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(CPermanentShadow, 0x38); +#endif class CPtrList; class CAutomobile; diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index d20cc0bf..c16f07d3 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -90,7 +90,9 @@ static psGlobalType PsGlobal; #include "Sprite2d.h" #include "AnimViewer.h" +#ifdef CHECK_STRUCT_SIZES VALIDATE_SIZE(psGlobalType, 0x28); +#endif // DirectShow interfaces IGraphBuilder *pGB = nil; diff --git a/src/text/Text.h b/src/text/Text.h index 00d1c5e6..a454a095 100644 --- a/src/text/Text.h +++ b/src/text/Text.h @@ -12,8 +12,11 @@ struct CKeyEntry wchar *value; char key[8]; }; + // If this fails, CKeyArray::Load will have to be fixed +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CKeyEntry) == 12, "CKeyEntry: error"); +#endif class CKeyArray { diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index 041302bf..16d1a2ef 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -197,7 +197,9 @@ public: static void SetAllTaxiLights(bool set); }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error"); +#endif inline uint8 GetCarDoorFlag(int32 carnode) { switch (carnode) { diff --git a/src/vehicles/Boat.h b/src/vehicles/Boat.h index 70407ab9..014b1e48 100644 --- a/src/vehicles/Boat.h +++ b/src/vehicles/Boat.h @@ -72,7 +72,9 @@ public: }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CBoat) == 0x484, "CBoat: error"); +#endif extern float MAX_WAKE_LENGTH; extern float MIN_WAKE_INTERVAL; diff --git a/src/vehicles/Cranes.h b/src/vehicles/Cranes.h index c0502638..4d4c8fb4 100644 --- a/src/vehicles/Cranes.h +++ b/src/vehicles/Cranes.h @@ -72,7 +72,9 @@ public: float GetHeightToDropoffHeight() { return m_fDropoffHeight + (m_bIsCrusher ? 7.0f : 2.0f); } }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CCrane) == 128, "CCrane: error"); +#endif class CCranes { diff --git a/src/vehicles/Heli.h b/src/vehicles/Heli.h index 39e4cbcf..d41afb58 100644 --- a/src/vehicles/Heli.h +++ b/src/vehicles/Heli.h @@ -95,4 +95,7 @@ public: static void ActivateHeli(bool activate); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CHeli) == 0x33C, "CHeli: error"); +#endif diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h index 79738858..f0c5902b 100644 --- a/src/vehicles/Plane.h +++ b/src/vehicles/Plane.h @@ -63,7 +63,10 @@ public: static bool HasCesnaBeenDestroyed(void); static bool HasDropOffCesnaBeenShotDown(void); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CPlane) == 0x29C, "CPlane: error"); +#endif extern float LandingPoint; extern float TakeOffPoint; diff --git a/src/vehicles/Train.h b/src/vehicles/Train.h index bf541250..6fb73169 100644 --- a/src/vehicles/Train.h +++ b/src/vehicles/Train.h @@ -91,4 +91,7 @@ public: float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail); static void UpdateTrains(void); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CTrain) == 0x2E4, "CTrain: error"); +#endif \ No newline at end of file diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 110ff97c..d8891628 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -291,9 +291,11 @@ public: static bool m_bDisableMouseSteering; }; +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error"); static_assert(offsetof(CVehicle, m_pCurGroundEntity) == 0x1E0, "CVehicle: error"); static_assert(offsetof(CVehicle, m_nAlarmState) == 0x1A0, "CVehicle: error"); static_assert(offsetof(CVehicle, m_nLastWeaponDamage) == 0x228, "CVehicle: error"); +#endif void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle); -- cgit v1.2.3