diff --git a/src/game/Object/Player.h b/src/game/Object/Player.h index f890c5c53..cf8178c15 100644 --- a/src/game/Object/Player.h +++ b/src/game/Object/Player.h @@ -1933,6 +1933,7 @@ class Player : public Unit static Team TeamForRace(uint8 race); Team GetTeam() const { return m_team; } + PvpTeamIndex GetTeamId() const { return m_team == ALLIANCE ? TEAM_INDEX_ALLIANCE : TEAM_INDEX_HORDE; } static uint32 getFactionForRace(uint8 race); void setFactionForRace(uint8 race); diff --git a/src/game/Server/Opcodes.cpp b/src/game/Server/Opcodes.cpp index aefa627c5..2dc1d9034 100644 --- a/src/game/Server/Opcodes.cpp +++ b/src/game/Server/Opcodes.cpp @@ -40,11 +40,11 @@ static void DefineOpcode(uint16 opcode, const char* name, SessionStatus status, #define OPCODE( name, status, packetProcessing, handler ) DefineOpcode( name, #name, status, packetProcessing, handler ) /// Correspondence between opcodes and their names -OpcodeHandler opcodeTable[MAX_OPCODE_TABLE_SIZE]; +OpcodeHandler opcodeTable[NUM_MSG_TYPES]; void InitializeOpcodes() { - for(uint16 i = 0; i < MAX_OPCODE_TABLE_SIZE; ++i) + for (uint16 i = 0; i < NUM_MSG_TYPES; ++i) DefineOpcode(i, "UNKNOWN", STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL); OPCODE(MSG_WOW_CONNECTION, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_EarlyProccess ); diff --git a/src/game/Server/Opcodes.h b/src/game/Server/Opcodes.h index 2a69fc806..69ccb05fb 100644 --- a/src/game/Server/Opcodes.h +++ b/src/game/Server/Opcodes.h @@ -1441,7 +1441,10 @@ enum Opcodes SMSG_START_TIMER = 0x59A5, // 4.3.4 15595 }; -#define MAX_OPCODE_TABLE_SIZE 0xFFFF +// Don't forget to change this value and add opcode name to Opcodes.cpp when you add new opcode! +#define NUM_MSG_TYPES 0xFFFF + +#define NUM_MSG_TYPES 0xFFFF extern void InitializeOpcodes(); @@ -1473,7 +1476,7 @@ struct OpcodeHandler void (WorldSession::*handler)(WorldPacket& recvPacket); }; -extern OpcodeHandler opcodeTable[MAX_OPCODE_TABLE_SIZE]; +extern OpcodeHandler opcodeTable[NUM_MSG_TYPES]; /// Lookup opcode name for human understandable logging inline const char* LookupOpcodeName(uint16 id) diff --git a/src/game/Server/SharedDefines.h b/src/game/Server/SharedDefines.h index 4c9152c0c..d26748fb4 100644 --- a/src/game/Server/SharedDefines.h +++ b/src/game/Server/SharedDefines.h @@ -740,6 +740,15 @@ enum Team ALLIANCE = 469, }; +enum PvpTeamIndex +{ + TEAM_INDEX_ALLIANCE = 0, + TEAM_INDEX_HORDE = 1, + TEAM_INDEX_NEUTRAL = 2, +}; + +#define PVP_TEAM_COUNT 2 + enum SpellEffects { SPELL_EFFECT_NONE = 0,