Skip to content

Commit a550bbf

Browse files
authored
Fix building crash (PR #3753)
1 parent 5f21c32 commit a550bbf

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Client/game_sa/CBuildingsPoolSA.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ void CBuildingsPoolSA::RemoveAllBuildings()
151151

152152
RemoveBuildingFromWorld(building);
153153

154+
if (building->HasMatrix())
155+
building->RemoveMatrix();
156+
154157
pBuildsingsPool->Release(i);
155158

156159
(*m_pOriginalBuildingsBackup)[i].first = true;

Client/game_sa/CEntitySA.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ class CEntitySAInterface
242242
using vtbl_DeleteRwObject = void(__thiscall*)(CEntitySAInterface * pEntity);
243243
((vtbl_DeleteRwObject)this->vtbl->DeleteRwObject)(this);
244244
};
245+
246+
bool HasMatrix() const noexcept { return Placeable.matrix != nullptr; }
247+
248+
void RemoveMatrix() { ((void(__thiscall*)(void*))0x54F3B0)(this); }
245249
};
246250
static_assert(sizeof(CEntitySAInterface) == 0x38, "Invalid size for CEntitySAInterface");
247251

0 commit comments

Comments
 (0)