Skip to content

Commit

Permalink
potential fix for liyunfan1223#469 (not 100% sure as can't reproduce)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzdeveloper committed Aug 15, 2024
1 parent 520633b commit f7d229d
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/RandomPlayerbotMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,18 +578,10 @@ void RandomPlayerbotMgr::CheckBgQueue()
if (!BgCheckTimer)
BgCheckTimer = time(nullptr);

uint32 count = 0;
uint32 visual_count = 0;

uint32 check_time = count > 0 ? 120 : 30;
if (time(nullptr) < (BgCheckTimer + check_time))
{
if (time(nullptr) < BgCheckTimer + 30)
return;
}
else
{
BgCheckTimer = time(nullptr);
}

BgCheckTimer = time(nullptr);

LOG_INFO("playerbots", "Checking BG Queue...");

Expand All @@ -600,7 +592,8 @@ void RandomPlayerbotMgr::CheckBgQueue()
if (!player->InBattlegroundQueue())
continue;

if (player->InBattleground() && player->GetBattleground()->GetStatus() == STATUS_WAIT_LEAVE)
Battleground* bg = player->GetBattleground();
if (bg && bg->GetStatus() == STATUS_WAIT_LEAVE)
continue;

TeamId teamId = player->GetTeamId();
Expand All @@ -611,7 +604,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
continue;

BattlegroundTypeId bgTypeId = sBattlegroundMgr->BGTemplateId(queueTypeId);
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
uint32 mapId = bg->GetMapId();
PvPDifficultyEntry const* pvpDiff = GetBattlegroundBracketByLevel(mapId, player->GetLevel());
if (!pvpDiff)
Expand Down Expand Up @@ -690,7 +683,8 @@ void RandomPlayerbotMgr::CheckBgQueue()
if (!IsRandomBot(bot))
continue;

if (bot->InBattleground() && bot->GetBattleground()->GetStatus() == STATUS_WAIT_LEAVE)
Battleground* bg = bot->GetBattleground();
if (bg && bg->GetStatus() == STATUS_WAIT_LEAVE)
continue;

TeamId teamId = bot->GetTeamId();
Expand All @@ -702,7 +696,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
continue;

BattlegroundTypeId bgTypeId = sBattlegroundMgr->BGTemplateId(queueTypeId);
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
uint32 mapId = bg->GetMapId();
PvPDifficultyEntry const* pvpDiff = GetBattlegroundBracketByLevel(mapId, bot->GetLevel());
if (!pvpDiff)
Expand Down

0 comments on commit f7d229d

Please sign in to comment.