diff options
| author | megamage <none@none> | 2009-02-27 12:58:02 -0600 |
|---|---|---|
| committer | megamage <none@none> | 2009-02-27 12:58:02 -0600 |
| commit | 59b52105745af10530079a1807c14e5ce3b181c3 (patch) | |
| tree | 15abb50e0d3c5060b0959cfb85b1cb31ead82ed2 /src | |
| parent | 361f4b2e3c15e46865c21af0759fc73eb749a33a (diff) | |
Finally fixed problem with joining rated arena matches.
Thx to balrok for help and testing. Author: Triply
--HG--
branch : trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/BattleGroundMgr.cpp | 29 | ||||
| -rw-r--r-- | src/game/BattleGroundMgr.h | 2 | ||||
| -rw-r--r-- | src/shared/revision_nr.h | 2 |
3 files changed, 17 insertions, 16 deletions
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index ec5f04d6623..c1cdc6d6f96 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -584,7 +584,7 @@ bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 } //this function tries to create battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam -bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBasedOnLevel queue_id, uint32 MinPlayersPerTeam) +bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBasedOnLevel queue_id) { uint32 minPlayers = bg_template->GetMinPlayersPerTeam(); uint32 maxPlayers = bg_template->GetMaxPlayersPerTeam(); @@ -622,9 +622,11 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBas if( abs((int32)(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())) > 2 ) return false; } - + //allow 1v0 if debug bg + if( sBattleGroundMgr.isTesting() && (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() >= MinPlayersPerTeam && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= MinPlayersPerTeam; + return m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers; } /* @@ -752,7 +754,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve if( !isRated ) { // if there are enough players in pools, start new battleground or non rated arena - if( CheckNormalMatch(bg_template, queue_id, MinPlayersPerTeam) ) + if( CheckNormalMatch(bg_template, queue_id) ) { // we successfully created a pool BattleGround * bg2 = NULL; @@ -1042,6 +1044,10 @@ void BattleGroundMgr::Update(uint32 diff) BattleGroundSet::iterator itr, next; for(uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++) { + itr = m_BattleGrounds[i].begin(); + // skip updating battleground template + if( itr != m_BattleGrounds[i].end() ) + ++itr; for(itr = m_BattleGrounds[i].begin(); itr != m_BattleGrounds[i].end(); itr = next) { next = itr; @@ -1473,15 +1479,9 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI // start the joining of the bg bg->SetStatus(STATUS_WAIT_JOIN); bg->SetQueueId(queue_id); - // initialize arena / rating info bg->SetArenaType(arenaType); - // set rating bg->SetRated(isRated); - /* will be setup in BG::Update() when the first player is ported in - if(!(bg->SetupBattleGround())) - */ - // add BG to free slot queue bg->AddToBGFreeSlotQueue(); @@ -1525,10 +1525,8 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA bg->SetTeamStartLoc(HORDE, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO); bg->SetLevelRange(LevelMin, LevelMax); - //reset() and add to free slot queue are called only when needed! - //bg->AddToBGFreeSlotQueue(); - - // do NOT add to update list, since this is a template battleground! + // add bg to update list + AddBattleGround(bg->GetInstanceID(), bg->GetTypeID(), bg); // return some not-null value, bgTypeId is good enough for me return bgTypeId; @@ -1750,6 +1748,9 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6 for(BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr) { + // skip sending battleground template + if( itr == m_BattleGrounds[bgTypeId].begin() ) + continue; if( PlayerLevel >= itr->second->GetMinLevel() && PlayerLevel <= itr->second->GetMaxLevel() ) { *data << uint32(itr->second->GetInstanceID()); diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 6a26783cd2f..41ad0728caf 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -75,7 +75,7 @@ class BattleGroundQueue void FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel queue_id); bool CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 MaxPlayersPerTeam, uint32 MinPlayersPerTeam); - bool CheckNormalMatch(BattleGround* bg_template, BGQueueIdBasedOnLevel queue_id, uint32 MinPlayersPerTeam); + bool CheckNormalMatch(BattleGround* bg_template, BGQueueIdBasedOnLevel queue_id); GroupQueueInfo * AddGroup(Player * leader, BattleGroundTypeId bgTypeId, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0); void AddPlayer(Player *plr, GroupQueueInfo *ginfo); void RemovePlayer(const uint64& guid, bool decreaseInvitedCount); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 353577efd89..57867a1c1c1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7353" + #define REVISION_NR "7354" #endif // __REVISION_NR_H__ |
