[7269] Use enum type for battleground queue type ids, and related cleanups.
* renamed a variable to make the content of it more clear: type->arenaslot
* renamed BattleGroundQueueTypeId-variables to bgQueueTypeId
just to make it easier reading the code (cause there existed
3 different names for this..)
* renamed GetBattleGroundQueueId to GetBattleGroundQueueTypeId
again this is just for better understanding
* Renamed [GS]etQueueType and m_Queue_type
* Renamed to [GS]etQueueId and m_QueueId
Author: balrok
--HG--
branch : trunk
This commit is contained in:
@@ -286,7 +286,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
if(Player *plr2 = objmgr.GetPlayer(group->Players.begin()->first))
|
||||
{
|
||||
BattleGround * bg = sBattleGroundMgr.GetBattleGroundTemplate(group->BgTypeId);
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId,group->ArenaType);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId,group->ArenaType);
|
||||
uint32 queueSlot = plr2->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
plr2->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs
|
||||
WorldPacket data;
|
||||
@@ -389,7 +389,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
||||
// not yet invited
|
||||
// set invitation
|
||||
ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID();
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
// loop through the players
|
||||
for(std::map<uint64,PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
|
||||
{
|
||||
@@ -501,9 +501,9 @@ bool BattleGroundQueue::BuildSelectionPool(BattleGroundTypeId bgTypeId, uint32 q
|
||||
// (this can happen in arenas mainly, since the preparation is shorter than the timer for the bgqueueremove event
|
||||
void BattleGroundQueue::BGEndedRemoveInvites(BattleGround *bg)
|
||||
{
|
||||
uint32 queue_id = bg->GetQueueType();
|
||||
uint32 queue_id = bg->GetQueueId();
|
||||
uint32 bgInstanceId = bg->GetInstanceID();
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
QueuedGroupsList::iterator itr, next;
|
||||
for(itr = m_QueuedGroups[queue_id].begin(); itr != m_QueuedGroups[queue_id].end(); itr = next)
|
||||
{
|
||||
@@ -543,8 +543,8 @@ void BattleGroundQueue::BGEndedRemoveInvites(BattleGround *bg)
|
||||
// remove player from queue, this might delete the ginfo as well! don't use that pointer after this!
|
||||
RemovePlayer(itr2->first, true);
|
||||
// this is probably unneeded, since this player was already invited -> does not fit when initing eligible groups
|
||||
// but updating the queue can't hurt
|
||||
Update(bg->GetTypeID(), bg->GetQueueType());
|
||||
// but updateing the queue can't hurt
|
||||
Update(bg->GetTypeID(), bg->GetQueueId());
|
||||
// send info to client
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, team, queueSlot, STATUS_NONE, 0, 0);
|
||||
@@ -573,7 +573,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uin
|
||||
if (m_QueuedGroups[queue_id].empty())
|
||||
return;
|
||||
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
||||
|
||||
//battleground with free slot for player should be always the last in this queue
|
||||
BGFreeSlotQueueType::iterator itr, next;
|
||||
@@ -583,7 +583,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uin
|
||||
++next;
|
||||
// battleground is running, so if:
|
||||
// DO NOT allow queue manager to invite new player to running arena
|
||||
if ((*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetQueueType() == queue_id && (*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE)
|
||||
if ((*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetQueueId() == queue_id && (*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE)
|
||||
{
|
||||
//we must check both teams
|
||||
BattleGround* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!)
|
||||
@@ -751,7 +751,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uin
|
||||
|
||||
// start the joining of the bg
|
||||
bg2->SetStatus(STATUS_WAIT_JOIN);
|
||||
bg2->SetQueueType(queue_id);
|
||||
bg2->SetQueueId(queue_id);
|
||||
// initialize arena / rating info
|
||||
bg2->SetArenaType(arenatype);
|
||||
// set rating
|
||||
@@ -904,7 +904,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uin
|
||||
|
||||
// start the joining of the bg
|
||||
bg2->SetStatus(STATUS_WAIT_JOIN);
|
||||
bg2->SetQueueType(queue_id);
|
||||
bg2->SetQueueId(queue_id);
|
||||
// initialize arena / rating info
|
||||
bg2->SetArenaType(arenatype);
|
||||
|
||||
@@ -956,7 +956,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
if (!bg)
|
||||
return true;
|
||||
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
|
||||
{
|
||||
@@ -992,7 +992,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
|
||||
sLog.outDebug("Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.",plr->GetGUIDLow(),m_BgInstanceGUID);
|
||||
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
|
||||
{
|
||||
@@ -1012,7 +1012,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
}
|
||||
plr->RemoveBattleGroundQueueId(bgQueueTypeId);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(m_PlayerGuid, true);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bg->GetTypeID(),bg->GetQueueType());
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bg->GetTypeID(),bg->GetQueueId());
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, m_PlayersTeam, queueSlot, STATUS_NONE, 0, 0);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
@@ -1792,7 +1792,7 @@ bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId)
|
||||
bgTypeId == BATTLEGROUND_RL );
|
||||
}
|
||||
|
||||
uint32 BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType)
|
||||
BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType)
|
||||
{
|
||||
switch(bgTypeId)
|
||||
{
|
||||
@@ -1821,14 +1821,14 @@ uint32 BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaTy
|
||||
case ARENA_TYPE_5v5:
|
||||
return BATTLEGROUND_QUEUE_5v5;
|
||||
default:
|
||||
return 0;
|
||||
return BATTLEGROUND_QUEUE_NONE;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
return BATTLEGROUND_QUEUE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
BattleGroundTypeId BattleGroundMgr::BGTemplateId(uint32 bgQueueTypeId)
|
||||
BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId)
|
||||
{
|
||||
switch(bgQueueTypeId)
|
||||
{
|
||||
@@ -1851,7 +1851,7 @@ BattleGroundTypeId BattleGroundMgr::BGTemplateId(uint32 bgQueueTypeId)
|
||||
}
|
||||
}
|
||||
|
||||
uint8 BattleGroundMgr::BGArenaType(uint32 bgQueueTypeId)
|
||||
uint8 BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId)
|
||||
{
|
||||
switch(bgQueueTypeId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user