[7384] Removed some comments.

Fixed problem that queues doesn't invite new players to already running battlegrounds.
Some other fixes for announce system will be soon.

Signed-off-by: Triply <triply@getmangos.com>
This commit is contained in:
Triply 2009-03-05 22:25:39 +01:00
parent 5179230901
commit bfa785fdb8
5 changed files with 24 additions and 33 deletions

View file

@ -36,7 +36,7 @@ BattleGround::BattleGround()
{ {
m_TypeID = BattleGroundTypeId(0); m_TypeID = BattleGroundTypeId(0);
m_InstanceID = 0; m_InstanceID = 0;
m_Status = 0; m_Status = STATUS_NONE;
m_EndTime = 0; m_EndTime = 0;
m_LastResurrectTime = 0; m_LastResurrectTime = 0;
m_QueueId = QUEUE_ID_MAX_LEVEL_19; m_QueueId = QUEUE_ID_MAX_LEVEL_19;

View file

@ -111,11 +111,11 @@ const uint32 Buff_Entries[3] = { BG_OBJECTID_SPEEDBUFF_ENTRY, BG_OBJECTID_REGENB
enum BattleGroundStatus enum BattleGroundStatus
{ {
STATUS_NONE = 0, STATUS_NONE = 0, // first status, should mean bg is not instance
STATUS_WAIT_QUEUE = 1, STATUS_WAIT_QUEUE = 1, // means bg is empty and waiting for queue
STATUS_WAIT_JOIN = 2, STATUS_WAIT_JOIN = 2, // this means, that BG has already started and it is waiting for more players
STATUS_IN_PROGRESS = 3, STATUS_IN_PROGRESS = 3, // means bg is running
STATUS_WAIT_LEAVE = 4 // custom STATUS_WAIT_LEAVE = 4 // means some faction has won BG and it is ending
}; };
struct BattleGroundPlayer struct BattleGroundPlayer
@ -273,7 +273,7 @@ class BattleGround
BattleGroundTypeId GetTypeID() const { return m_TypeID; } BattleGroundTypeId GetTypeID() const { return m_TypeID; }
BGQueueIdBasedOnLevel GetQueueId() const { return m_QueueId; } BGQueueIdBasedOnLevel GetQueueId() const { return m_QueueId; }
uint32 GetInstanceID() const { return m_InstanceID; } uint32 GetInstanceID() const { return m_InstanceID; }
uint32 GetStatus() const { return m_Status; } BattleGroundStatus GetStatus() const { return m_Status; }
uint32 GetStartTime() const { return m_StartTime; } uint32 GetStartTime() const { return m_StartTime; }
uint32 GetEndTime() const { return m_EndTime; } uint32 GetEndTime() const { return m_EndTime; }
uint32 GetLastResurrectTime() const { return m_LastResurrectTime; } uint32 GetLastResurrectTime() const { return m_LastResurrectTime; }
@ -286,7 +286,7 @@ class BattleGround
uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; } uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; }
uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; } uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; }
int GetStartDelayTime() const { return m_StartDelayTime; } int32 GetStartDelayTime() const { return m_StartDelayTime; }
uint8 GetArenaType() const { return m_ArenaType; } uint8 GetArenaType() const { return m_ArenaType; }
uint8 GetWinner() const { return m_Winner; } uint8 GetWinner() const { return m_Winner; }
uint32 GetBattlemasterEntry() const; uint32 GetBattlemasterEntry() const;
@ -302,7 +302,7 @@ class BattleGround
this->SetLevelRange((ID + 1) * 10 + diff, (ID + 2) * 10 - ((diff + 1) % 2)); this->SetLevelRange((ID + 1) * 10 + diff, (ID + 2) * 10 - ((diff + 1) % 2));
} }
void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; } void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; }
void SetStatus(uint32 Status) { m_Status = Status; } void SetStatus(BattleGroundStatus Status) { m_Status = Status; }
void SetStartTime(uint32 Time) { m_StartTime = Time; } void SetStartTime(uint32 Time) { m_StartTime = Time; }
void SetEndTime(uint32 Time) { m_EndTime = Time; } void SetEndTime(uint32 Time) { m_EndTime = Time; }
void SetLastResurrectTime(uint32 Time) { m_LastResurrectTime = Time; } void SetLastResurrectTime(uint32 Time) { m_LastResurrectTime = Time; }
@ -489,7 +489,7 @@ class BattleGround
/* Battleground */ /* Battleground */
BattleGroundTypeId m_TypeID; BattleGroundTypeId m_TypeID;
uint32 m_InstanceID; //BattleGround Instance's GUID! uint32 m_InstanceID; //BattleGround Instance's GUID!
uint32 m_Status; BattleGroundStatus m_Status;
uint32 m_StartTime; uint32 m_StartTime;
uint32 m_EndTime; uint32 m_EndTime;
uint32 m_LastResurrectTime; uint32 m_LastResurrectTime;
@ -497,9 +497,6 @@ class BattleGround
uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5 uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattleGroundMgr.BGFreeSlotQueue[bgTypeId] deque bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattleGroundMgr.BGFreeSlotQueue[bgTypeId] deque
bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
// this variable is not used .... it can be found in many other ways... but to store it in BG object instance is useless
//uint8 m_BattleGroundType; // 3=BG, 4=arena
//instead of uint8 (in previous line) is bool used
bool m_IsArena; bool m_IsArena;
uint8 m_Winner; // 0=alliance, 1=horde, 2=none uint8 m_Winner; // 0=alliance, 1=horde, 2=none
int32 m_StartDelayTime; int32 m_StartDelayTime;
@ -537,7 +534,7 @@ class BattleGround
uint32 m_MinPlayersPerTeam; uint32 m_MinPlayersPerTeam;
uint32 m_MinPlayers; uint32 m_MinPlayers;
/* Location */ /* Start location */
uint32 m_MapId; uint32 m_MapId;
float m_TeamStartLocX[BG_TEAMS_COUNT]; float m_TeamStartLocX[BG_TEAMS_COUNT];
float m_TeamStartLocY[BG_TEAMS_COUNT]; float m_TeamStartLocY[BG_TEAMS_COUNT];

View file

@ -370,7 +370,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
BattleGroundQueueTypeId bgQueueTypeId = BATTLEGROUND_QUEUE_NONE; BattleGroundQueueTypeId bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
// get the bg what we were invited to // get the bg what we were invited to
bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId,type); bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, type);
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers; BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID()); BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
if(itrPlayerStatus == qpMap.end()) if(itrPlayerStatus == qpMap.end())

View file

@ -113,17 +113,18 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
// add group to selection pool // add group to selection pool
// used when building selection pools // used when building selection pools
// returns true if we can invite more players, otherwise return false - (selection pool is set that time) // returns true if we can invite more players
// returns false when selection pool is set
bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount) bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount)
{ {
//if group is larger than desired count - don't allow to add it to pool //if group is larger than desired count - don't allow to add it to pool
if (!ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size()) if( !ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size() )
{ {
SelectedGroups.push_back(ginfo); SelectedGroups.push_back(ginfo);
// increase selected players count // increase selected players count
PlayerCount += ginfo->Players.size(); PlayerCount += ginfo->Players.size();
} }
if (PlayerCount == desiredCount) if( PlayerCount < desiredCount )
return true; return true;
return false; return false;
} }
@ -553,7 +554,8 @@ bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32
{ {
for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr) for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr)
{ {
if( !(*itr)->IsInvitedToBGInstanceGUID && m_SelectionPools[i].AddGroup((*itr), maxPlayers) ) //if itr can join BG and player count is less that maxPlayers, then add group to selectionpool
if( !(*itr)->IsInvitedToBGInstanceGUID && !m_SelectionPools[i].AddGroup((*itr), maxPlayers) )
break; break;
} }
} }
@ -575,7 +577,7 @@ bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32
{ {
//we must insert group to normal queue and erase pointer from premade queue //we must insert group to normal queue and erase pointer from premade queue
m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].push_front((*itr)); m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].push_front((*itr));
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE + i].erase(itr); //pop_front(); m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE + i].erase(itr);
} }
} }
} }
@ -612,7 +614,7 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBas
for(; itr_team[j] != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + j].end(); ++(itr_team[j])) for(; itr_team[j] != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + j].end(); ++(itr_team[j]))
{ {
if( !(*(itr_team[j]))->IsInvitedToBGInstanceGUID ) if( !(*(itr_team[j]))->IsInvitedToBGInstanceGUID )
if( m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % BG_TEAMS_COUNT].GetPlayerCount()) ) if( !m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % BG_TEAMS_COUNT].GetPlayerCount()) )
break; break;
} }
// do not allow to start bg with more than 2 players more on 1 faction // do not allow to start bg with more than 2 players more on 1 faction
@ -656,12 +658,9 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_
//invite players to other selection pool //invite players to other selection pool
for(; itr_team2 != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr_team2) for(; itr_team2 != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr_team2)
{ {
if( !(*itr_team2)->IsInvitedToBGInstanceGUID ) //if selection pool is full then break;
{ if( !(*itr_team2)->IsInvitedToBGInstanceGUID && !m_SelectionPools[otherTeam].AddGroup(*itr_team2, minPlayersPerTeam) )
m_SelectionPools[otherTeam].AddGroup(*itr_team2, minPlayersPerTeam); break;
if( m_SelectionPools[otherTeam].GetPlayerCount() == minPlayersPerTeam )
break;
}
} }
if( m_SelectionPools[otherTeam].GetPlayerCount() != minPlayersPerTeam ) if( m_SelectionPools[otherTeam].GetPlayerCount() != minPlayersPerTeam )
return false; return false;
@ -1533,11 +1532,6 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
// reset the new bg (set status to status_wait_queue from status_none) // reset the new bg (set status to status_wait_queue from status_none)
bg->Reset(); bg->Reset();
if( bg->isBattleGround() && sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) )
{
sWorld.SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, bg->GetName(), bg->GetMinLevel(), bg->GetMaxLevel());
}
// start the joining of the bg // start the joining of the bg
bg->SetStatus(STATUS_WAIT_JOIN); bg->SetStatus(STATUS_WAIT_JOIN);
bg->SetQueueId(queue_id); bg->SetQueueId(queue_id);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7383" #define REVISION_NR "7384"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__