[7250] Use bg type ids enum insted raw values and catch some bugs in result for fixing.

* Replace max bg type checks by DBC valid index check
* Use in functions and fields BattlegroundTypeId type instead uint32
* Fixed wrong use bg queue ids instead bg type ids in queue update/remove function calls.
  Many bg have same raw values for type id and queue id but some can be affected by this bug:
  BATTLEGROUND_EY, BATTLEGROUND_SA, and all areans (with small arena/team size exceptions)
* Move Battlemaster to bg type ids map fron ObjectMgr to BatteleGroundMgr.
* Remobe redundent for header itself includes for BG headers.
* Use Auction location enum instead raw valus.
This commit is contained in:
VladimirMangos 2009-02-08 09:28:41 +03:00
parent e355084376
commit 5a4358dda9
29 changed files with 319 additions and 262 deletions

View file

@ -19,6 +19,7 @@
#include "Object.h"
#include "Player.h"
#include "BattleGround.h"
#include "BattleGroundMgr.h"
#include "Creature.h"
#include "MapManager.h"
#include "Language.h"
@ -26,11 +27,14 @@
#include "SpellAuras.h"
#include "ArenaTeam.h"
#include "World.h"
#include "Group.h"
#include "ObjectMgr.h"
#include "WorldPacket.h"
#include "Util.h"
BattleGround::BattleGround()
{
m_TypeID = 0;
m_TypeID = BattleGroundTypeId(0);
m_InstanceID = 0;
m_Status = 0;
m_EndTime = 0;
@ -768,7 +772,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
{
if(!team) team = plr->GetTeam();
uint32 bgTypeId = GetTypeID();
BattleGroundTypeId bgTypeId = GetTypeID();
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
// if arena, remove the specific arena auras
if(isArena())
@ -1507,3 +1511,11 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
}
return count;
}
void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid )
{
Group* &old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE];
if(old_raid) old_raid->SetBattlegroundGroup(NULL);
if(bg_raid) bg_raid->SetBattlegroundGroup(this);
old_raid = bg_raid;
}