From bf83e51009841bb568e404a0ca63048441ee5c04 Mon Sep 17 00:00:00 2001 From: Uladzislau Nikalayevich Date: Sat, 28 Sep 2024 21:59:43 +0300 Subject: [PATCH 1/3] test fix --- Client/game_sa/CBuildingsPoolSA.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Client/game_sa/CBuildingsPoolSA.cpp b/Client/game_sa/CBuildingsPoolSA.cpp index caa392c132e..1d39cc9b44e 100644 --- a/Client/game_sa/CBuildingsPoolSA.cpp +++ b/Client/game_sa/CBuildingsPoolSA.cpp @@ -151,6 +151,9 @@ void CBuildingsPoolSA::RemoveAllBuildings() RemoveBuildingFromWorld(building); + if (building->Placeable.matrix) + ((void(__thiscall*)(void*))0x54F3B0)(building); + pBuildsingsPool->Release(i); (*m_pOriginalBuildingsBackup)[i].first = true; From 67dd9b5105f770212ebd86bb4d6b27cfb65352cf Mon Sep 17 00:00:00 2001 From: Uladzislau Nikalayevich Date: Sat, 28 Sep 2024 22:37:29 +0300 Subject: [PATCH 2/3] Style fix --- Client/game_sa/CBuildingsPoolSA.cpp | 4 ++-- Client/game_sa/CEntitySA.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Client/game_sa/CBuildingsPoolSA.cpp b/Client/game_sa/CBuildingsPoolSA.cpp index 1d39cc9b44e..50ae14bb3c4 100644 --- a/Client/game_sa/CBuildingsPoolSA.cpp +++ b/Client/game_sa/CBuildingsPoolSA.cpp @@ -151,8 +151,8 @@ void CBuildingsPoolSA::RemoveAllBuildings() RemoveBuildingFromWorld(building); - if (building->Placeable.matrix) - ((void(__thiscall*)(void*))0x54F3B0)(building); + if (building->HasMatrix()) + building->RemoveMatrix(); pBuildsingsPool->Release(i); diff --git a/Client/game_sa/CEntitySA.h b/Client/game_sa/CEntitySA.h index 548cb657f6b..b6f76563cab 100644 --- a/Client/game_sa/CEntitySA.h +++ b/Client/game_sa/CEntitySA.h @@ -242,6 +242,10 @@ class CEntitySAInterface using vtbl_DeleteRwObject = void(__thiscall*)(CEntitySAInterface * pEntity); ((vtbl_DeleteRwObject)this->vtbl->DeleteRwObject)(this); }; + + bool HasMatrix() const noexcept { return Placeable.matrix != nullptr; }; + + void RemoveMatrix() { ((void(__thiscall*)(void*))0x54F3B0)(this); } }; static_assert(sizeof(CEntitySAInterface) == 0x38, "Invalid size for CEntitySAInterface"); From 2e87c493eaf7823a2186b78677452683d7cafbd7 Mon Sep 17 00:00:00 2001 From: Marek Kulik Date: Wed, 2 Oct 2024 22:59:08 +0200 Subject: [PATCH 3/3] Update Client/game_sa/CEntitySA.h --- Client/game_sa/CEntitySA.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/game_sa/CEntitySA.h b/Client/game_sa/CEntitySA.h index b6f76563cab..e5c27ea61cf 100644 --- a/Client/game_sa/CEntitySA.h +++ b/Client/game_sa/CEntitySA.h @@ -243,7 +243,7 @@ class CEntitySAInterface ((vtbl_DeleteRwObject)this->vtbl->DeleteRwObject)(this); }; - bool HasMatrix() const noexcept { return Placeable.matrix != nullptr; }; + bool HasMatrix() const noexcept { return Placeable.matrix != nullptr; } void RemoveMatrix() { ((void(__thiscall*)(void*))0x54F3B0)(this); } };