Skip to content

Commit

Permalink
Fix SetBuildingPoolSize resets RemoveAllBuildings
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNormalnij committed May 29, 2024
1 parent 06d1f1d commit 0b3dc01
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Client/game_sa/CGameSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,7 @@ void CGameSA::RemoveAllBuildings()

m_pPools->GetDummyPool().RemoveAllBuildingLods();
m_pPools->GetBuildingsPool().RemoveAllBuildings();
m_isBuildingsRemoved = true;
}

void CGameSA::RestoreGameBuildings()
Expand All @@ -917,15 +918,23 @@ void CGameSA::RestoreGameBuildings()
m_pPools->GetDummyPool().RestoreAllBuildingsLods();

m_pIplStore->SetDynamicIplStreamingEnabled(true, [](CIplSAInterface* ipl) { return memcmp("barriers", ipl->name, 8) != 0; });
m_isBuildingsRemoved = false;
}

bool CGameSA::SetBuildingPoolSize(size_t size)
{
RemoveAllBuildings();
const bool shouldRemoveBuilding = !m_isBuildingsRemoved;
if (shouldRemoveBuilding)
{
RemoveAllBuildings();
}

bool status = m_pPools->GetBuildingsPool().Resize(size);

RestoreGameBuildings();
if (shouldRemoveBuilding)
{
RestoreGameBuildings();
}

return status;
}
Expand Down
1 change: 1 addition & 0 deletions Client/game_sa/CGameSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ class CGameSA : public CGame
bool m_isBurnFlippedCarsEnabled{true};
bool m_isFireballDestructEnabled{true};
bool m_isRoadSignsTextEnabled{true};
bool m_isBuildingsRemoved{false};

static unsigned int& ClumpOffset;

Expand Down

0 comments on commit 0b3dc01

Please sign in to comment.