[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.
Author: VladimirMangos
--HG--
branch : trunk
This commit is contained in:
+12
-31
@@ -22,13 +22,16 @@
|
||||
#define __BATTLEGROUND_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Opcodes.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
class Creature;
|
||||
class GameObject;
|
||||
class Group;
|
||||
class Player;
|
||||
class WorldPacket;
|
||||
|
||||
struct WorldSafeLocsEntry;
|
||||
|
||||
enum BattleGroundSounds
|
||||
{
|
||||
SOUND_HORDE_WINS = 8454,
|
||||
@@ -132,22 +135,6 @@ struct BattleGroundObjectInfo
|
||||
uint32 spellid;
|
||||
};
|
||||
|
||||
enum BattleGroundTypeId
|
||||
{
|
||||
BATTLEGROUND_AV = 1,
|
||||
BATTLEGROUND_WS = 2,
|
||||
BATTLEGROUND_AB = 3,
|
||||
BATTLEGROUND_NA = 4,
|
||||
BATTLEGROUND_BE = 5,
|
||||
BATTLEGROUND_AA = 6,
|
||||
BATTLEGROUND_EY = 7,
|
||||
BATTLEGROUND_RL = 8,
|
||||
BATTLEGROUND_SA = 9,
|
||||
BATTLEGROUND_DS = 10,
|
||||
BATTLEGROUND_RV = 11
|
||||
};
|
||||
#define MAX_BATTLEGROUND_TYPE_ID 12
|
||||
|
||||
// handle the queue types and bg types separately to enable joining queue for different sized arenas at the same time
|
||||
enum BattleGroundQueueTypeId
|
||||
{
|
||||
@@ -278,7 +265,7 @@ class BattleGround
|
||||
/* Battleground */
|
||||
// Get methods:
|
||||
char const* GetName() const { return m_Name; }
|
||||
uint32 GetTypeID() const { return m_TypeID; }
|
||||
BattleGroundTypeId GetTypeID() const { return m_TypeID; }
|
||||
uint32 GetQueueType() const { return m_Queue_type; }
|
||||
uint32 GetInstanceID() const { return m_InstanceID; }
|
||||
uint32 GetStatus() const { return m_Status; }
|
||||
@@ -301,7 +288,7 @@ class BattleGround
|
||||
|
||||
// Set methods:
|
||||
void SetName(char const* Name) { m_Name = Name; }
|
||||
void SetTypeID(uint32 TypeID) { m_TypeID = TypeID; }
|
||||
void SetTypeID(BattleGroundTypeId TypeID) { m_TypeID = TypeID; }
|
||||
void SetQueueType(uint32 ID) { m_Queue_type = ID; }
|
||||
void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; }
|
||||
void SetStatus(uint32 Status) { m_Status = Status; }
|
||||
@@ -398,13 +385,7 @@ class BattleGround
|
||||
|
||||
/* Raid Group */
|
||||
Group *GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; }
|
||||
void 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;
|
||||
}
|
||||
void SetBgRaid(uint32 TeamID, Group *bg_raid);
|
||||
|
||||
virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
|
||||
@@ -499,7 +480,7 @@ class BattleGround
|
||||
BGHonorMode m_HonorMode;
|
||||
private:
|
||||
/* Battleground */
|
||||
uint32 m_TypeID; //Battleground type, defined in enum BattleGroundTypeId
|
||||
BattleGroundTypeId m_TypeID;
|
||||
uint32 m_InstanceID; //BattleGround Instance's GUID!
|
||||
uint32 m_Status;
|
||||
uint32 m_StartTime;
|
||||
|
||||
Reference in New Issue
Block a user