mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 22:26:22 +00:00
[CFBG module part 3] Core/BG: Rework functions, delete ASSERT's. (#2010)
This commit is contained in:
@@ -923,7 +923,8 @@ void BattlegroundMgr::RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 ins
|
||||
|
||||
void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId)
|
||||
{
|
||||
ASSERT(!ginfo->IsInvitedToBGInstanceGUID);
|
||||
if (ginfo->IsInvitedToBGInstanceGUID)
|
||||
return;
|
||||
|
||||
// set side if needed
|
||||
if (teamId != TEAM_NEUTRAL)
|
||||
@@ -942,13 +943,12 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
|
||||
ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME;
|
||||
|
||||
// loop through the players
|
||||
for (std::set<uint64>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
|
||||
for (auto itr : ginfo->Players)
|
||||
{
|
||||
// get the player
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(*itr);
|
||||
|
||||
// player is removed from queue when logging out
|
||||
ASSERT(player);
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(itr);
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
// update average wait time
|
||||
bgQueue.PlayerInvitedToBGUpdateAverageWaitTime(ginfo);
|
||||
@@ -963,12 +963,12 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
|
||||
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgQueueTypeId, ginfo->RemoveInviteTime);
|
||||
bgQueue.AddEvent(removeEvent, INVITE_ACCEPT_WAIT_TIME);
|
||||
|
||||
WorldPacket data;
|
||||
|
||||
// Check queueSlot
|
||||
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
|
||||
ASSERT(queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
|
||||
|
||||
// send status packet
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo->BgTypeId);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user