BG: Final fix against potential inconsistencies

* Check both bgInstanceCount / bgInstances.size

to help counter against possible inconsistencies

* Final fix against inconsistencies
This commit is contained in:
SaW
2025-01-22 14:12:38 +01:00
committed by GitHub
parent 2574b66527
commit d3e3372121

View File

@@ -756,7 +756,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
// Process player bots
for (auto& [guid, bot] : playerBots)
{
if (!bot || !bot->InBattlegroundQueue() || !bot->IsInWorld() || !IsRandomBot(bot))
if (!bot || !bot->InBattlegroundQueue() || !IsRandomBot(bot))
continue;
Battleground* bg = bot->GetBattleground();
@@ -873,8 +873,11 @@ void RandomPlayerbotMgr::CheckBgQueue()
std::vector<uint32> abBrackets = parseBrackets(sPlayerbotAIConfig->randomBotAutoJoinABBrackets);
std::vector<uint32> wsBrackets = parseBrackets(sPlayerbotAIConfig->randomBotAutoJoinWSBrackets);
// Check both bgInstanceCount / bgInstances.size
// to help counter against inconsistencies
auto updateRatedArenaInstanceCount = [&](uint32 queueType, uint32 bracket, uint32 minCount) {
if (BattlegroundData[queueType][bracket].activeRatedArenaQueue == 0 &&
BattlegroundData[queueType][bracket].ratedArenaInstanceCount < minCount &&
BattlegroundData[queueType][bracket].ratedArenaInstances.size() < minCount)
BattlegroundData[queueType][bracket].activeRatedArenaQueue = 1;
};
@@ -883,6 +886,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
for (uint32 bracket : brackets)
{
if (BattlegroundData[queueType][bracket].activeBgQueue == 0 &&
BattlegroundData[queueType][bracket].bgInstanceCount < minCount &&
BattlegroundData[queueType][bracket].bgInstances.size() < minCount)
BattlegroundData[queueType][bracket].activeBgQueue = 1;
}