diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 9ad37f7b1..c6ede3665 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -582,7 +582,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(); @@ -620,9 +620,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; } /* @@ -750,7 +752,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; @@ -1040,6 +1042,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; @@ -1471,15 +1477,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(); @@ -1523,10 +1523,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; @@ -1748,6 +1746,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 fb0ea7b37..804d23ffe 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -73,7 +73,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 353577efd..57867a1c1 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__