aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Battlegrounds/BattlegroundQueue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Battlegrounds/BattlegroundQueue.cpp')
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundQueue.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index a021a28ee0d..2dbe799150c 100755
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -281,7 +281,7 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, Battleg
}
//remove player from queue and from group info, if group info is empty then remove it too
-void BattlegroundQueue::RemovePlayer(const uint64 guid, bool decreaseInvitedCount)
+void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
{
//Player *plr = ObjectAccessor::FindPlayer(guid);
@@ -322,6 +322,7 @@ void BattlegroundQueue::RemovePlayer(const uint64 guid, bool decreaseInvitedCoun
}
}
}
+
//player can't be in queue without group, but just in case
if (bracket_id == -1)
{
@@ -342,32 +343,24 @@ void BattlegroundQueue::RemovePlayer(const uint64 guid, bool decreaseInvitedCoun
// if invited to bg, and should decrease invited count, then do it
if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID)
- {
- Battleground* bg = sBattlegroundMgr->GetBattleground(group->IsInvitedToBGInstanceGUID, group->BgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : group->BgTypeId);
- if (bg)
+ if (Battleground* bg = sBattlegroundMgr->GetBattleground(group->IsInvitedToBGInstanceGUID, group->BgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : group->BgTypeId))
bg->DecreaseInvitedCount(group->Team);
- }
// remove player queue info
m_QueuedPlayers.erase(itr);
// announce to world if arena team left queue for rated match, show only once
if (group->ArenaType && group->IsRated && group->Players.empty() && sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE))
- {
- ArenaTeam *Team = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId);
- if (Team)
+ if (ArenaTeam *Team = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId))
sWorld->SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, Team->GetName().c_str(), group->ArenaType, group->ArenaType, group->ArenaTeamRating);
- }
- //if player leaves queue and he is invited to rated arena match, then he have to lose
+ // if player leaves queue and he is invited to rated arena match, then he have to lose
if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount)
{
- ArenaTeam * at = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId);
- if (at)
+ if (ArenaTeam * at = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId))
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
- Player *plr = ObjectAccessor::FindPlayer(guid);
- if (plr)
+ if (Player *plr = ObjectAccessor::FindPlayer(guid))
at->MemberLost(plr, group->OpponentsMatchmakerRating);
else
at->OfflineMemberLost(guid, group->OpponentsMatchmakerRating);
@@ -405,7 +398,7 @@ void BattlegroundQueue::RemovePlayer(const uint64 guid, bool decreaseInvitedCoun
}
//returns true when player pl_guid is in queue and is invited to bgInstanceGuid
-bool BattlegroundQueue::IsPlayerInvited(const uint64 pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
+bool BattlegroundQueue::IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
{
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid);
return (qItr != m_QueuedPlayers.end()
@@ -413,7 +406,7 @@ bool BattlegroundQueue::IsPlayerInvited(const uint64 pl_guid, const uint32 bgIns
&& qItr->second.GroupInfo->RemoveInviteTime == removeTime);
}
-bool BattlegroundQueue::GetPlayerGroupInfoData(const uint64 guid, GroupQueueInfo* ginfo)
+bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo)
{
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid);
if (qItr == m_QueuedPlayers.end())
@@ -918,7 +911,6 @@ void BattlegroundQueue::Update(BattlegroundTypeId bgTypeId, BattlegroundBracketI
GroupsQueueType::iterator itr_team[BG_TEAMS_COUNT];
//optimalization : --- we dont need to use selection_pools - each update we select max 2 groups
-
for (uint32 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; i++)
{
// take the group that joined first
@@ -936,6 +928,7 @@ void BattlegroundQueue::Update(BattlegroundTypeId bgTypeId, BattlegroundBracketI
}
}
}
+
// now we are done if we have 2 groups - ali vs horde!
// if we don't have, we must try to continue search in same queue
// tmp variables are correctly set
@@ -955,6 +948,7 @@ void BattlegroundQueue::Update(BattlegroundTypeId bgTypeId, BattlegroundBracketI
}
}
}
+
// this code isn't much userfriendly - but it is supposed to continue search for mathing group in ALLIANCE queue
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
{