Skip to content

Commit

Permalink
Fix building crash (PR multitheftauto#3753)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNormalnij authored Oct 2, 2024
1 parent 5f21c32 commit a550bbf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Client/game_sa/CBuildingsPoolSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ void CBuildingsPoolSA::RemoveAllBuildings()

RemoveBuildingFromWorld(building);

if (building->HasMatrix())
building->RemoveMatrix();

pBuildsingsPool->Release(i);

(*m_pOriginalBuildingsBackup)[i].first = true;
Expand Down
4 changes: 4 additions & 0 deletions Client/game_sa/CEntitySA.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit a550bbf

Please sign in to comment.