aboutsummaryrefslogtreecommitdiff
path: root/src/game/BattleGroundMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/BattleGroundMgr.cpp')
-rw-r--r--src/game/BattleGroundMgr.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp
index 06bdbf54c3f..9ee9c841de3 100644
--- a/src/game/BattleGroundMgr.cpp
+++ b/src/game/BattleGroundMgr.cpp
@@ -83,7 +83,7 @@ void BattleGroundQueue::SelectionPool::Init()
// remove group info from selection pool
// returns true when we need to try to add new group to selection pool
-// or false when pool is ok
+// returns false when selection pool is ok or when we kicked smaller group than we need to kick
// sometimes it can be called on empty selection pool
bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
{
@@ -107,7 +107,8 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
GroupQueueInfo* ginfo = (*groupToKick);
SelectedGroups.erase(groupToKick);
PlayerCount -= ginfo->Players.size();
- if (abs((int32)(ginfo->Players.size() - size)) <= 1)
+ //return false if we kicked smaller group or there are enough players in selection pool
+ if (ginfo->Players.size() <= size + 1)
return false;
}
return true;
@@ -115,8 +116,8 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
// add group to selection pool
// used when building selection pools
-// returns true if we can invite more players
-// returns false when selection pool is set
+// returns true if we can invite more players, or when we added group to selection pool
+// returns false when selection pool is full
bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount)
{
//if group is larger than desired count - don't allow to add it to pool
@@ -125,6 +126,7 @@ bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 de
SelectedGroups.push_back(ginfo);
// increase selected players count
PlayerCount += ginfo->Players.size();
+ return true;
}
if( PlayerCount < desiredCount )
return true;
@@ -501,7 +503,7 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel
//if ali selection is already empty, then kick horde group, but if there are less horde than ali in bg - break;
if( !m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() )
{
- if( aliFree <= diffHorde - 1 )
+ if( aliFree <= diffHorde + 1 )
break;
m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffHorde - diffAli);
}
@@ -516,7 +518,7 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel
}
if( !m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() )
{
- if( hordeFree <= diffAli - 1 )
+ if( hordeFree <= diffAli + 1 )
break;
m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffAli - diffHorde);
}
@@ -624,7 +626,7 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBas
return false;
}
//allow 1v0 if debug bg
- if( sBattleGroundMgr.isTesting() && (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()) )
+ if( sBattleGroundMgr.isTesting() && bg_template->isBattleGround() && (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()) )
return true;
//return true if there are enough players in selection pools - enable to work .debug bg command correctly
return m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers;