From 003f3f22d06cb3afd5d6e70b2de248ecd0a18b86 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:48:22 +0800 Subject: [PATCH] [saco] Implement/match `CVehicle::ResetPointers()` --- saco/game/vehicle.cpp | 13 +++++++++++++ saco/game/vehicle.h | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/saco/game/vehicle.cpp b/saco/game/vehicle.cpp index 388ab0a..2b564da 100644 --- a/saco/game/vehicle.cpp +++ b/saco/game/vehicle.cpp @@ -22,3 +22,16 @@ void CVehicle::LinkToInterior(int iInterior) } //----------------------------------------------------------- +// If the game has internally destroyed the vehicle +// during this frame, the vehicle pointer should become 0 + +void CVehicle::ResetPointers() +{ + if(!m_pVehicle) return; + + m_pVehicle = GamePool_Vehicle_GetAt(m_dwGTAId); + m_pEntity = (ENTITY_TYPE *)m_pVehicle; +} + +//----------------------------------------------------------- + diff --git a/saco/game/vehicle.h b/saco/game/vehicle.h index 0242c43..fbe53b5 100644 --- a/saco/game/vehicle.h +++ b/saco/game/vehicle.h @@ -10,10 +10,17 @@ class CVehicle : public CEntity { public: - char _gap48[112]; + char _gap48[4]; + + VEHICLE_TYPE *m_pVehicle; + + char _gap50[104]; CVehicle( int iType, float fPosX, float fPosY, float fPosZ, float fRotation = 0.0f, BOOL bKeepModelLoaded = FALSE, int a8 = 0); + void ResetPointers(); + + void LinkToInterior(int iInterior); };