From 356243cde616e6fd585926cfaf2e78dd4328755d Mon Sep 17 00:00:00 2001 From: Uladzislau Nikalayevich Date: Wed, 26 Jun 2024 22:10:09 +0300 Subject: [PATCH] Fix LODs crash --- .../deathmatch/logic/CClientBuildingManager.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientBuildingManager.cpp b/Client/mods/deathmatch/logic/CClientBuildingManager.cpp index 198fd23ed2..bde13a0892 100644 --- a/Client/mods/deathmatch/logic/CClientBuildingManager.cpp +++ b/Client/mods/deathmatch/logic/CClientBuildingManager.cpp @@ -98,9 +98,22 @@ void CClientBuildingManager::DestroyAllForABit() void CClientBuildingManager::RestoreDestroyed() { - for (CClientBuilding* building : GetBuildings()) + bool hasInvalidLods = true; + while (hasInvalidLods) { - building->Create(); + hasInvalidLods = false; + for (CClientBuilding* building : GetBuildings()) + { + const CClientBuilding* highLodBuilding = building->GetHighLodBuilding(); + if (highLodBuilding && !highLodBuilding->IsValid()) + { + hasInvalidLods = true; + } + else + { + building->Create(); + } + } } }