BG: restore !bot->IsInWorld() check (#891)

* Update RandomPlayerbotMgr.cpp

* Restore !bot->IsInWorld()
This commit is contained in:
SaW 2025-01-22 16:44:44 +01:00 committed by GitHub
parent d3e3372121
commit 4e7d00b1a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -654,6 +654,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
LOG_DEBUG("playerbots", "Checking BG Queue..."); LOG_DEBUG("playerbots", "Checking BG Queue...");
// Initialize Battleground Data (do not clear here) // Initialize Battleground Data (do not clear here)
for (int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket) for (int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
{ {
for (int queueType = BATTLEGROUND_QUEUE_AV; queueType < MAX_BATTLEGROUND_QUEUE_TYPES; ++queueType) for (int queueType = BATTLEGROUND_QUEUE_AV; queueType < MAX_BATTLEGROUND_QUEUE_TYPES; ++queueType)
@ -756,7 +757,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
// Process player bots // Process player bots
for (auto& [guid, bot] : playerBots) for (auto& [guid, bot] : playerBots)
{ {
if (!bot || !bot->InBattlegroundQueue() || !IsRandomBot(bot)) if (!bot || !bot->InBattlegroundQueue() || !bot->IsInWorld() || !IsRandomBot(bot))
continue; continue;
Battleground* bg = bot->GetBattleground(); Battleground* bg = bot->GetBattleground();
@ -874,7 +875,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
std::vector<uint32> wsBrackets = parseBrackets(sPlayerbotAIConfig->randomBotAutoJoinWSBrackets); std::vector<uint32> wsBrackets = parseBrackets(sPlayerbotAIConfig->randomBotAutoJoinWSBrackets);
// Check both bgInstanceCount / bgInstances.size // Check both bgInstanceCount / bgInstances.size
// to help counter against inconsistencies // to help counter against potentional inconsistencies
auto updateRatedArenaInstanceCount = [&](uint32 queueType, uint32 bracket, uint32 minCount) { auto updateRatedArenaInstanceCount = [&](uint32 queueType, uint32 bracket, uint32 minCount) {
if (BattlegroundData[queueType][bracket].activeRatedArenaQueue == 0 && if (BattlegroundData[queueType][bracket].activeRatedArenaQueue == 0 &&
BattlegroundData[queueType][bracket].ratedArenaInstanceCount < minCount && BattlegroundData[queueType][bracket].ratedArenaInstanceCount < minCount &&