[7399] Rewrited BattleGround starting code - moved it to battleground class. Author: Triply

Fixed message color for premature finish warnings.
    Fixed .debug bg command won't allow 1v0 arenas now, only battlegrounds 1v0.
    Added battleground announcer message removed in [7384].

[7401] Fixed bgqueue invitation to already started battlegrounds - not tested. Author: Triply

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-07 12:05:30 -06:00
parent f63c07e669
commit 520ce96257
29 changed files with 489 additions and 450 deletions
+9 -7
View File
@@ -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;