Code style (game + scripts only):
"( " --> "("
" )" --> ")"
--HG--
branch : trunk
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
#include "ProgressBar.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1( BattleGroundMgr );
|
||||
INSTANTIATE_SINGLETON_1(BattleGroundMgr);
|
||||
|
||||
/*********************************************************/
|
||||
/*** BATTLEGROUND QUEUE SYSTEM ***/
|
||||
@@ -296,7 +296,7 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleG
|
||||
team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE
|
||||
}
|
||||
//check if there is enought values(we always add values > 0)
|
||||
if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1] )
|
||||
if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1])
|
||||
return (m_SumOfWaitTimes[team_index][bracket_id] / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME);
|
||||
else
|
||||
//if there aren't enough values return 0 - not available
|
||||
@@ -431,9 +431,9 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
bool BattleGroundQueue::IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
|
||||
{
|
||||
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid);
|
||||
return ( qItr != m_QueuedPlayers.end()
|
||||
return (qItr != m_QueuedPlayers.end()
|
||||
&& qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == bgInstanceGuid
|
||||
&& qItr->second.GroupInfo->RemoveInviteTime == removeTime );
|
||||
&& qItr->second.GroupInfo->RemoveInviteTime == removeTime);
|
||||
}
|
||||
|
||||
bool BattleGroundQueue::GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo)
|
||||
@@ -547,7 +547,7 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId
|
||||
// At first we need to compare free space in bg and our selection pool
|
||||
int32 diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount());
|
||||
int32 diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
|
||||
while ( abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0) )
|
||||
while (abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0))
|
||||
{
|
||||
//each cycle execution we need to kick at least 1 group
|
||||
if (diffAli < diffHorde)
|
||||
@@ -598,10 +598,10 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
|
||||
//start premade match
|
||||
//if groups aren't invited
|
||||
GroupsQueueType::const_iterator ali_group, horde_group;
|
||||
for ( ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group)
|
||||
for (ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group)
|
||||
if (!(*ali_group)->IsInvitedToBGInstanceGUID)
|
||||
break;
|
||||
for ( horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group)
|
||||
for (horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group)
|
||||
if (!(*horde_group)->IsInvitedToBGInstanceGUID)
|
||||
break;
|
||||
|
||||
@@ -668,8 +668,8 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGround
|
||||
uint32 j = BG_TEAM_ALLIANCE;
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
|
||||
j = BG_TEAM_HORDE;
|
||||
if ( sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0
|
||||
&& m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers )
|
||||
if (sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0
|
||||
&& m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers)
|
||||
{
|
||||
//we will try to invite more groups to team with less players indexed by j
|
||||
++(itr_team[j]); //this will not cause a crash, because for cycle above reached break;
|
||||
@@ -698,7 +698,7 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
|
||||
uint32 teamIndex = BG_TEAM_ALLIANCE;
|
||||
uint32 otherTeam = BG_TEAM_HORDE;
|
||||
uint32 otherTeamId = HORDE;
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam )
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam)
|
||||
{
|
||||
teamIndex = BG_TEAM_HORDE;
|
||||
otherTeam = BG_TEAM_ALLIANCE;
|
||||
@@ -757,10 +757,10 @@ should be called from BattleGround::RemovePlayer function in some cases
|
||||
void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating)
|
||||
{
|
||||
//if no players in queue - do nothing
|
||||
if ( m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
|
||||
if (m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() &&
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() &&
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty() )
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
|
||||
return;
|
||||
|
||||
//battleground with free slot for player should be always in the beggining of the queue
|
||||
@@ -771,8 +771,8 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||
next = itr;
|
||||
++next;
|
||||
// DO NOT allow queue manager to invite new player to arena
|
||||
if ( (*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
|
||||
(*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE )
|
||||
if ((*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
|
||||
(*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE)
|
||||
{
|
||||
BattleGround* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!)
|
||||
// and iterator is invalid
|
||||
@@ -881,7 +881,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||
{
|
||||
// if there are enough players in pools, start new battleground or non rated arena
|
||||
if (CheckNormalMatch(bg_template, bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam)
|
||||
|| (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam)) )
|
||||
|| (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam)))
|
||||
{
|
||||
// we successfully created a pool
|
||||
BattleGround * bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, arenaType, false);
|
||||
@@ -904,7 +904,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||
// found out the minimum and maximum ratings the newly added team should battle against
|
||||
// arenaRating is the rating of the latest joined team, or 0
|
||||
// 0 is on (automatic update call) and we must set it to team's with longest wait time
|
||||
if (!arenaRating )
|
||||
if (!arenaRating)
|
||||
{
|
||||
GroupQueueInfo* front1 = NULL;
|
||||
GroupQueueInfo* front2 = NULL;
|
||||
@@ -949,9 +949,9 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||
for (; itr_team[i] != m_QueuedGroups[bracket_id][i].end(); ++(itr_team[i]))
|
||||
{
|
||||
// if group match conditions, then add it to pool
|
||||
if ( !(*itr_team[i])->IsInvitedToBGInstanceGUID
|
||||
if (!(*itr_team[i])->IsInvitedToBGInstanceGUID
|
||||
&& (((*itr_team[i])->ArenaTeamRating >= arenaMinRating && (*itr_team[i])->ArenaTeamRating <= arenaMaxRating)
|
||||
|| (*itr_team[i])->JoinTime < discardTime) )
|
||||
|| (*itr_team[i])->JoinTime < discardTime))
|
||||
{
|
||||
m_SelectionPools[i].AddGroup((*itr_team[i]), MaxPlayersPerTeam);
|
||||
// break for cycle to be able to start selecting another group from same faction queue
|
||||
@@ -969,9 +969,9 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||
++itr_team[BG_TEAM_ALLIANCE];
|
||||
for (; itr_team[BG_TEAM_ALLIANCE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++(itr_team[BG_TEAM_ALLIANCE]))
|
||||
{
|
||||
if ( !(*itr_team[BG_TEAM_ALLIANCE])->IsInvitedToBGInstanceGUID
|
||||
if (!(*itr_team[BG_TEAM_ALLIANCE])->IsInvitedToBGInstanceGUID
|
||||
&& (((*itr_team[BG_TEAM_ALLIANCE])->ArenaTeamRating >= arenaMinRating && (*itr_team[BG_TEAM_ALLIANCE])->ArenaTeamRating <= arenaMaxRating)
|
||||
|| (*itr_team[BG_TEAM_ALLIANCE])->JoinTime < discardTime) )
|
||||
|| (*itr_team[BG_TEAM_ALLIANCE])->JoinTime < discardTime))
|
||||
{
|
||||
m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*itr_team[BG_TEAM_ALLIANCE]), MaxPlayersPerTeam);
|
||||
break;
|
||||
@@ -985,9 +985,9 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||
++itr_team[BG_TEAM_HORDE];
|
||||
for (; itr_team[BG_TEAM_HORDE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++(itr_team[BG_TEAM_HORDE]))
|
||||
{
|
||||
if ( !(*itr_team[BG_TEAM_HORDE])->IsInvitedToBGInstanceGUID
|
||||
if (!(*itr_team[BG_TEAM_HORDE])->IsInvitedToBGInstanceGUID
|
||||
&& (((*itr_team[BG_TEAM_HORDE])->ArenaTeamRating >= arenaMinRating && (*itr_team[BG_TEAM_HORDE])->ArenaTeamRating <= arenaMaxRating)
|
||||
|| (*itr_team[BG_TEAM_HORDE])->JoinTime < discardTime) )
|
||||
|| (*itr_team[BG_TEAM_HORDE])->JoinTime < discardTime))
|
||||
{
|
||||
m_SelectionPools[BG_TEAM_HORDE].AddGroup((*itr_team[BG_TEAM_HORDE]), MaxPlayersPerTeam);
|
||||
break;
|
||||
@@ -1041,7 +1041,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||
|
||||
bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
Player* plr = objmgr.GetPlayer( m_PlayerGuid );
|
||||
Player* plr = objmgr.GetPlayer(m_PlayerGuid);
|
||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||
if (!plr)
|
||||
return true;
|
||||
@@ -1075,7 +1075,7 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/)
|
||||
|
||||
/*
|
||||
this event has many possibilities when it is executed:
|
||||
1. player is in battleground ( he clicked enter on invitation window )
|
||||
1. player is in battleground (he clicked enter on invitation window)
|
||||
2. player left battleground queue and he isn't there any more
|
||||
3. player left battleground queue and he joined it again and IsInvitedToBGInstanceGUID = 0
|
||||
4. player left queue and he joined again and he has been invited to same battleground again -> we should not remove him from queue yet
|
||||
@@ -1084,7 +1084,7 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/)
|
||||
*/
|
||||
bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
Player* plr = objmgr.GetPlayer( m_PlayerGuid );
|
||||
Player* plr = objmgr.GetPlayer(m_PlayerGuid);
|
||||
if (!plr)
|
||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||
return true;
|
||||
@@ -1487,7 +1487,7 @@ BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundT
|
||||
return NULL;
|
||||
}
|
||||
itr = m_BattleGrounds[bgTypeId].find(InstanceID);
|
||||
return ( (itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : NULL );
|
||||
return ((itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : NULL);
|
||||
}
|
||||
|
||||
BattleGround * BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTypeId)
|
||||
@@ -1510,7 +1510,7 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI
|
||||
uint32 lastId = 0;
|
||||
for (std::set<uint32>::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracket_id].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracket_id].end();)
|
||||
{
|
||||
if ( (++lastId) != *itr) //if there is a gap between the ids, we will break..
|
||||
if ((++lastId) != *itr) //if there is a gap between the ids, we will break..
|
||||
break;
|
||||
lastId = *itr;
|
||||
}
|
||||
@@ -1772,7 +1772,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u battlegrounds", count );
|
||||
sLog.outString(">> Loaded %u battlegrounds", count);
|
||||
}
|
||||
|
||||
void BattleGroundMgr::InitAutomaticArenaPointDistribution()
|
||||
@@ -1876,7 +1876,7 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
|
||||
*data << uint32(*itr);
|
||||
++count;
|
||||
}
|
||||
data->put<uint32>( count_pos , count);
|
||||
data->put<uint32>(count_pos , count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1915,13 +1915,13 @@ void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *
|
||||
|
||||
bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
return ( bgTypeId == BATTLEGROUND_AA ||
|
||||
return (bgTypeId == BATTLEGROUND_AA ||
|
||||
bgTypeId == BATTLEGROUND_BE ||
|
||||
bgTypeId == BATTLEGROUND_NA ||
|
||||
bgTypeId == BATTLEGROUND_DS ||
|
||||
bgTypeId == BATTLEGROUND_RV ||
|
||||
bgTypeId == BATTLEGROUND_RL ||
|
||||
bgTypeId == BATTLEGROUND_DS );
|
||||
bgTypeId == BATTLEGROUND_DS);
|
||||
}
|
||||
|
||||
BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType)
|
||||
@@ -2074,21 +2074,21 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
||||
{
|
||||
mBattleMastersMap.clear(); // need for reload case
|
||||
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query( "SELECT entry,bg_template FROM battlemaster_entry" );
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,bg_template FROM battlemaster_entry");
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
if (!result)
|
||||
{
|
||||
barGoLink bar( 1 );
|
||||
barGoLink bar(1);
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded 0 battlemaster entries - table is empty!" );
|
||||
sLog.outString(">> Loaded 0 battlemaster entries - table is empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
barGoLink bar( result->GetRowCount() );
|
||||
barGoLink bar(result->GetRowCount());
|
||||
|
||||
do
|
||||
{
|
||||
@@ -2107,10 +2107,10 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
||||
|
||||
mBattleMastersMap[entry] = BattleGroundTypeId(bgTypeId);
|
||||
|
||||
} while ( result->NextRow() );
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u battlemaster entries", count );
|
||||
sLog.outString(">> Loaded %u battlemaster entries", count);
|
||||
}
|
||||
bool BattleGroundMgr::IsBGWeekend(BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user