From bcdbbe235bf906151b75e70737cbc049156f685c Mon Sep 17 00:00:00 2001 From: Alexander Akulich Date: Sun, 24 Mar 2024 21:24:51 +0300 Subject: [PATCH] MapRotation: Keep the data on map disabled (missing in new maprotation) --- src/game/server/gamecontroller.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index b912e87d..d3ffb5ca 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -22,7 +22,8 @@ class CMapInfo class CMapInfoEx : public CMapInfo { public: - int mTimestamp = 0; + int mTimestamp{}; + bool mEnabled{}; const char *Name() const { return aMapName; } void SetName(const char *pMapName); @@ -518,11 +519,12 @@ void IGameController::GetMapRotationInfo(CMapRotationInfo *pMapRotationInfo) void IGameController::SyncSmartMapRotationData() { - s_aMapInfo.Clear(); + // Disable all maps + for (CMapInfoEx &info : s_aMapInfo) { + info.mEnabled = false; + } - // handle maprotation const char *pMapRotation = Config()->m_SvMaprotation; - const char *pNextMap = pMapRotation; char aMapNameBuffer[64]; while(*pNextMap) @@ -535,7 +537,15 @@ void IGameController::SyncSmartMapRotationData() } aMapNameBuffer[WordLen] = 0; - OnMapAdded(aMapNameBuffer); + CMapInfoEx *pInfo = GetMapInfo(aMapNameBuffer); + if(pInfo) + { + pInfo->mEnabled = true; + } + else + { + OnMapAdded(aMapNameBuffer); + } pNextMap += WordLen + 1; } @@ -571,6 +581,9 @@ void IGameController::ConSmartMapRotationStatus() if(NameLength > MaxMapNameLength) MaxMapNameLength = NameLength; + if(!Info.mEnabled) + continue; + if(CurrentActivePlayers < Info.MinimumPlayers) continue; @@ -586,6 +599,8 @@ void IGameController::ConSmartMapRotationStatus() for(int i = 0; i < s_aMapInfo.Size(); ++i) { const CMapInfoEx &Info = s_aMapInfo.At(i); + if(!Info.mEnabled) + continue; bool Skipped = false; @@ -916,6 +931,9 @@ void IGameController::SmartMapCycle() for(const CMapInfoEx &Info : s_aMapInfo) { + if(!Info.mEnabled) + continue; + if(CurrentActivePlayers < Info.MinimumPlayers) continue; @@ -931,6 +949,8 @@ void IGameController::SmartMapCycle() for(int i = 0; i < s_aMapInfo.Size(); ++i) { const CMapInfoEx &Info = s_aMapInfo.At(i); + if(!Info.mEnabled) + continue; if(CurrentActivePlayers < Info.MinimumPlayers) continue;