Core/Misc: converted more macros to constexpr
This commit is contained in:
1 parent
e750e1b335
commit
4b7d68830a
10 files changed
+52
-51
No files matched your search
@@ -22,9 +22,9 @@
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
#define MAX_ITEM_PROTO_SOCKETS 3
|
||||
#define MAX_ITEM_PROTO_SPELLS 5
|
||||
#define MAX_ITEM_PROTO_STATS 10
|
||||
constexpr uint8 MAX_ITEM_PROTO_SOCKETS = 3;
|
||||
constexpr uint8 MAX_ITEM_PROTO_SPELLS = 5;
|
||||
constexpr uint8 MAX_ITEM_PROTO_STATS = 10;
|
||||
|
||||
struct ItemEntry
|
||||
{
|
||||
@@ -117,8 +117,8 @@ struct ItemSparseEntry
|
||||
int32 CurrencySubstitutionCount; // 130
|
||||
};
|
||||
|
||||
#define MAX_ITEM_EXT_COST_ITEMS 5
|
||||
#define MAX_ITEM_EXT_COST_CURRENCIES 5
|
||||
constexpr uint8 MAX_ITEM_EXT_COST_ITEMS = 5;
|
||||
constexpr uint8 MAX_ITEM_EXT_COST_CURRENCIES = 5;
|
||||
|
||||
struct ItemExtendedCostEntry
|
||||
{
|
||||
@@ -139,7 +139,7 @@ struct ItemExtendedCostEntry
|
||||
uint32 RequiredAchievement;
|
||||
};
|
||||
|
||||
#define KEYCHAIN_SIZE 32
|
||||
constexpr uint8 KEYCHAIN_SIZE = 32;
|
||||
|
||||
struct KeyChainEntry
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ enum BattlegroundBracketId // bracketId for lev
|
||||
};
|
||||
|
||||
// must be max value in PvPDificulty slot+1
|
||||
#define MAX_BATTLEGROUND_BRACKETS 16
|
||||
constexpr uint8 MAX_BATTLEGROUND_BRACKETS = 16;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct DBCPosition2D
|
||||
@@ -373,7 +373,7 @@ enum AchievementCriteriaTypes : uint8
|
||||
// ACHIEVEMENT_CRITERIA_TYPE_ABANDONED_LFR_DUNGEON = 150, // NYI (1 criteria:18773 in DBC) name state TBC Classic - internal statistics only?
|
||||
};
|
||||
|
||||
#define ACHIEVEMENT_CRITERIA_TYPE_TOTAL 151
|
||||
constexpr uint8 ACHIEVEMENT_CRITERIA_TYPE_TOTAL = 151;
|
||||
|
||||
enum class AreaFlags : uint32
|
||||
{
|
||||
@@ -439,11 +439,11 @@ enum Difficulty : uint8
|
||||
RAID_DIFFICULTY_25MAN_HEROIC = 3
|
||||
};
|
||||
|
||||
#define RAID_DIFFICULTY_MASK_25MAN 1 // since 25man difficulties are 1 and 3, we can check them like that
|
||||
constexpr uint8 RAID_DIFFICULTY_MASK_25MAN = 1; // since 25man difficulties are 1 and 3, we can check them like that
|
||||
|
||||
#define MAX_DUNGEON_DIFFICULTY 3
|
||||
#define MAX_RAID_DIFFICULTY 4
|
||||
#define MAX_DIFFICULTY 4
|
||||
constexpr uint8 MAX_DUNGEON_DIFFICULTY = 3;
|
||||
constexpr uint8 MAX_RAID_DIFFICULTY = 4;
|
||||
constexpr uint8 MAX_DIFFICULTY = 4;
|
||||
|
||||
enum SpawnMask
|
||||
{
|
||||
@@ -621,9 +621,9 @@ enum class SpellCategoryFlags : uint8
|
||||
|
||||
DEFINE_ENUM_FLAG(SpellCategoryFlags);
|
||||
|
||||
#define MAX_SPELL_EFFECTS 3
|
||||
#define MAX_EFFECT_MASK 7
|
||||
#define MAX_SPELL_REAGENTS 8
|
||||
constexpr uint8 MAX_SPELL_EFFECTS = 3;
|
||||
constexpr uint8 MAX_EFFECT_MASK = 7;
|
||||
constexpr uint8 MAX_SPELL_REAGENTS = 8;
|
||||
|
||||
enum class SpellItemEnchantmentFlags : uint32
|
||||
{
|
||||
@@ -635,9 +635,9 @@ enum class SpellItemEnchantmentFlags : uint32
|
||||
|
||||
DEFINE_ENUM_FLAG(SpellItemEnchantmentFlags);
|
||||
|
||||
#define MAX_TALENT_RANK 5
|
||||
#define MAX_PET_TALENT_RANK 3 // use in calculations, expected <= MAX_TALENT_RANK
|
||||
#define MAX_TALENT_TABS 3
|
||||
constexpr uint8 MAX_TALENT_RANK = 5;
|
||||
constexpr uint8 MAX_PET_TALENT_RANK = 3; // use in calculations, expected <= MAX_TALENT_RANK
|
||||
constexpr uint8 MAX_TALENT_TABS = 3;
|
||||
|
||||
enum class SpellShapeshiftFormFlags : int32
|
||||
{
|
||||
@@ -662,7 +662,7 @@ enum class SpellShapeshiftFormFlags : int32
|
||||
|
||||
DEFINE_ENUM_FLAG(SpellShapeshiftFormFlags);
|
||||
|
||||
#define TaxiMaskSize 114
|
||||
constexpr uint8 TaxiMaskSize = 114;
|
||||
typedef std::array<uint8, TaxiMaskSize> TaxiMask;
|
||||
|
||||
enum TaxiNodeFlags
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "Opcodes.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#define PET_XP_FACTOR 0.05f
|
||||
constexpr float PET_XP_FACTOR = 0.05f;
|
||||
|
||||
Pet::Pet(Player* owner, PetType type) :
|
||||
Guardian(nullptr, owner, true), m_usedTalentCount(0), m_removed(false),
|
||||
|
||||
@@ -25,7 +25,7 @@ enum PetType
|
||||
MAX_PET_TYPE = 4
|
||||
};
|
||||
|
||||
#define MAX_PET_STABLES 20
|
||||
constexpr uint8 MAX_PET_STABLES = 20;
|
||||
|
||||
// stored in character_pet.slot
|
||||
enum PetSaveMode
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <string>
|
||||
|
||||
/// Maximum number of CompactUnitFrames profiles
|
||||
#define MAX_CUF_PROFILES 5
|
||||
constexpr uint8 MAX_CUF_PROFILES = 5;
|
||||
|
||||
/// Bit index used in the many bool options of CompactUnitFrames
|
||||
enum CUFBoolOptions
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "Define.h"
|
||||
#include "Object.h"
|
||||
|
||||
#define CINEMATIC_LOOKAHEAD (2 * IN_MILLISECONDS)
|
||||
#define CINEMATIC_UPDATEDIFF 500
|
||||
constexpr uint32 CINEMATIC_LOOKAHEAD = 2 * IN_MILLISECONDS;
|
||||
constexpr uint32 CINEMATIC_UPDATEDIFF = 500;
|
||||
|
||||
class Player;
|
||||
struct FlyByCamera;
|
||||
|
||||
@@ -35,8 +35,8 @@ enum TotemSpells
|
||||
};
|
||||
|
||||
// Totems spells
|
||||
#define SENTRY_STONECLAW_SPELLID 55277
|
||||
#define SENTRY_BIND_SIGHT_SPELLID 6277
|
||||
constexpr uint32 SENTRY_STONECLAW_SPELLID = 55277;
|
||||
constexpr uint32 SENTRY_BIND_SIGHT_SPELLID = 6277;
|
||||
|
||||
class TC_GAME_API Totem : public Minion
|
||||
{
|
||||
|
||||
@@ -20,14 +20,15 @@
|
||||
|
||||
#include "Define.h"
|
||||
#include "UnitDefines.h"
|
||||
#include <array>
|
||||
|
||||
class SpellInfo;
|
||||
class Unit;
|
||||
class WorldPacket;
|
||||
|
||||
#define UNIT_ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
|
||||
#define UNIT_ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24)
|
||||
#define MAKE_UNIT_ACTION_BUTTON(A, T) (uint32(A) | (uint32(T) << 24))
|
||||
constexpr uint32 UNIT_ACTION_BUTTON_ACTION(uint32 x) { return x & 0x00FFFFFF; }
|
||||
constexpr uint32 UNIT_ACTION_BUTTON_TYPE(uint32 x) { return (x & 0xFF000000) >> 24; }
|
||||
constexpr uint32 MAKE_UNIT_ACTION_BUTTON(uint32 a, uint32 t) { return a | (t << 24); }
|
||||
|
||||
struct UnitActionBarEntry
|
||||
{
|
||||
@@ -84,7 +85,7 @@ enum ActionBarIndex
|
||||
ACTION_BAR_INDEX_END = 10
|
||||
};
|
||||
|
||||
#define MAX_UNIT_ACTION_BAR_INDEX (ACTION_BAR_INDEX_END-ACTION_BAR_INDEX_START)
|
||||
constexpr uint8 MAX_UNIT_ACTION_BAR_INDEX = ACTION_BAR_INDEX_END - ACTION_BAR_INDEX_START;
|
||||
|
||||
struct TC_GAME_API CharmInfo
|
||||
{
|
||||
@@ -136,8 +137,8 @@ struct TC_GAME_API CharmInfo
|
||||
private:
|
||||
|
||||
Unit* _unit;
|
||||
UnitActionBarEntry PetActionBar[MAX_UNIT_ACTION_BAR_INDEX];
|
||||
CharmSpellInfo _charmspells[4];
|
||||
std::array<UnitActionBarEntry, MAX_UNIT_ACTION_BAR_INDEX> PetActionBar;
|
||||
std::array<CharmSpellInfo, 4> _charmspells;
|
||||
CommandStates _CommandState;
|
||||
uint32 _petnumber;
|
||||
|
||||
|
||||
@@ -32,15 +32,15 @@
|
||||
#include <memory>
|
||||
#include <stack>
|
||||
|
||||
#define WORLD_TRIGGER 12999
|
||||
constexpr uint32 WORLD_TRIGGER = 12999;
|
||||
|
||||
#define MAX_SPELL_CHARM 4
|
||||
#define MAX_SPELL_VEHICLE 6
|
||||
#define MAX_SPELL_POSSESS 8
|
||||
#define MAX_SPELL_CONTROL_BAR 10
|
||||
constexpr uint8 MAX_SPELL_CHARM = 4;
|
||||
constexpr uint8 MAX_SPELL_VEHICLE = 6;
|
||||
constexpr uint8 MAX_SPELL_POSSESS = 8;
|
||||
constexpr uint8 MAX_SPELL_CONTROL_BAR = 10;
|
||||
|
||||
#define MAX_AGGRO_RESET_TIME 10 // in seconds
|
||||
#define MAX_AGGRO_RADIUS 45.0f // yards
|
||||
constexpr uint8 MAX_AGGRO_RESET_TIME = 10; // in seconds
|
||||
constexpr float MAX_AGGRO_RADIUS = 45.0f; // yards
|
||||
|
||||
enum VictimState
|
||||
{
|
||||
@@ -352,7 +352,7 @@ enum CombatRating
|
||||
CR_MASTERY = 25,
|
||||
};
|
||||
|
||||
#define MAX_COMBAT_RATING 26
|
||||
constexpr uint8 MAX_COMBAT_RATING = 26;
|
||||
|
||||
enum DamageEffectType : uint8
|
||||
{
|
||||
@@ -597,13 +597,13 @@ enum CurrentSpellTypes : uint8
|
||||
CURRENT_AUTOREPEAT_SPELL = 3
|
||||
};
|
||||
|
||||
#define CURRENT_FIRST_NON_MELEE_SPELL 1
|
||||
#define CURRENT_MAX_SPELL 4
|
||||
constexpr uint8 CURRENT_FIRST_NON_MELEE_SPELL = 1;
|
||||
constexpr uint8 CURRENT_MAX_SPELL = 4;
|
||||
|
||||
typedef std::list<Player*> SharedVisionList;
|
||||
|
||||
// for clearing special attacks
|
||||
#define REACTIVE_TIMER_START 4000
|
||||
constexpr uint32 REACTIVE_TIMER_START = 4000;
|
||||
|
||||
enum ReactiveType
|
||||
{
|
||||
@@ -635,8 +635,8 @@ struct PositionUpdateInfo
|
||||
};
|
||||
|
||||
// delay time next attack to prevent client attack animation problems
|
||||
#define ATTACK_DISPLAY_DELAY 200
|
||||
#define MAX_PLAYER_STEALTH_DETECT_RANGE 30.0f // max distance for detection targets by player
|
||||
constexpr uint32 ATTACK_DISPLAY_DELAY = 200;
|
||||
constexpr float MAX_PLAYER_STEALTH_DETECT_RANGE = 30.0f; // max distance for detection targets by player
|
||||
|
||||
class TC_GAME_API Unit : public WorldObject
|
||||
{
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
#include "Define.h"
|
||||
#include <string>
|
||||
|
||||
#define BASE_MINDAMAGE 1.0f
|
||||
#define BASE_MAXDAMAGE 2.0f
|
||||
#define BASE_ATTACK_TIME 2000
|
||||
constexpr float BASE_MINDAMAGE = 1.0f;
|
||||
constexpr float BASE_MAXDAMAGE = 2.0f;
|
||||
constexpr uint32 BASE_ATTACK_TIME = 2000;
|
||||
|
||||
#define MAX_EQUIPMENT_ITEMS 3
|
||||
constexpr uint8 MAX_EQUIPMENT_ITEMS = 3;
|
||||
|
||||
// byte value (UNIT_FIELD_BYTES_1, 0)
|
||||
enum UnitStandStateType : uint8
|
||||
@@ -349,7 +349,7 @@ enum UnitMoveType
|
||||
MOVE_PITCH_RATE = 8
|
||||
};
|
||||
|
||||
#define MAX_MOVE_TYPE 9
|
||||
constexpr uint8 MAX_MOVE_TYPE = 9;
|
||||
|
||||
enum HitInfo
|
||||
{
|
||||
@@ -381,7 +381,7 @@ enum HitInfo
|
||||
HITINFO_FAKE_DAMAGE = 0x01000000 // enables damage animation even if no damage done, set only if no damage
|
||||
};
|
||||
|
||||
#define MAX_DECLINED_NAME_CASES 5
|
||||
constexpr uint8 MAX_DECLINED_NAME_CASES = 5;
|
||||
|
||||
struct DeclinedName
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user