From 9d6b2d8095b277f2962104cbebdf707c5e5ccc6d Mon Sep 17 00:00:00 2001 From: JonathanSteinbuch Date: Fri, 4 Dec 2020 20:24:25 +0100 Subject: [PATCH] Reverted the "performance optimization" changes, added two Asserts, removed team determining every frame --- libs/s25main/EconomyModeHandler.cpp | 4 +--- libs/s25main/ingameWindows/iwEconomicProgress.cpp | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/s25main/EconomyModeHandler.cpp b/libs/s25main/EconomyModeHandler.cpp index ba0fd9bfac..1b39464df1 100644 --- a/libs/s25main/EconomyModeHandler.cpp +++ b/libs/s25main/EconomyModeHandler.cpp @@ -125,6 +125,7 @@ void EconomyModeHandler::Serialize(SerializedGameData& sgd) const void EconomyModeHandler::DetermineTeams() { + RTTR_Assert(economyModeTeams.empty()); for(unsigned i = 0; i < gwg->GetNumPlayers(); ++i) { if(gwg->GetPlayer(i).isUsed()) @@ -200,9 +201,6 @@ void EconomyModeHandler::UpdateAmounts() } } - // Compute Teams - DetermineTeams(); - // Compute the amounts for the teams std::fill(maxAmountsATeamCollected.begin(), maxAmountsATeamCollected.end(), 0); for(auto& team : economyModeTeams) diff --git a/libs/s25main/ingameWindows/iwEconomicProgress.cpp b/libs/s25main/ingameWindows/iwEconomicProgress.cpp index f265d79244..afffcd2bd2 100644 --- a/libs/s25main/ingameWindows/iwEconomicProgress.cpp +++ b/libs/s25main/ingameWindows/iwEconomicProgress.cpp @@ -166,6 +166,8 @@ void iwEconomicProgress::Msg_PaintBefore() const std::vector& economyModeTeams = eH->GetTeams(); const GamePlayer& mainPlayer = gwv.GetPlayer(); + RTTR_Assert(economyModeTeams.size() == teamOrder.size()); + // make sure the amounts are current eH->UpdateAmounts();