refactor(Core): apply clang-tidy modernize-use-default-member-init (#3827)

This commit is contained in:
Francesco Borzì
2020-12-07 20:34:06 +01:00
committed by GitHub
parent 1cf39b3d22
commit c5a35efd7b
47 changed files with 352 additions and 366 deletions

View File

@@ -251,31 +251,28 @@ typedef std::unordered_map<uint32, EquipmentInfoContainerInternal> EquipmentInfo
// from `creature` table
struct CreatureData
{
CreatureData() : id(0), mapid(0), phaseMask(0), displayid(0), equipmentId(0),
posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0),
wander_distance(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0),
spawnMask(0), npcflag(0), unit_flags(0), dynamicflags(0), dbData(true), overwrittenZ(false) { }
uint32 id; // entry in creature_template
uint16 mapid;
uint32 phaseMask;
uint32 displayid;
int8 equipmentId;
float posX;
float posY;
float posZ;
float orientation;
uint32 spawntimesecs;
float wander_distance;
uint32 currentwaypoint;
uint32 curhealth;
uint32 curmana;
uint8 movementType;
uint8 spawnMask;
uint32 npcflag;
uint32 unit_flags; // enum UnitFlags mask values
uint32 dynamicflags;
bool dbData;
bool overwrittenZ;
CreatureData() { }
uint32 id{0}; // entry in creature_template
uint16 mapid{0};
uint32 phaseMask{0};
uint32 displayid{0};
int8 equipmentId{0};
float posX{0.0f};
float posY{0.0f};
float posZ{0.0f};
float orientation{0.0f};
uint32 spawntimesecs{0};
float wander_distance{0.0f};
uint32 currentwaypoint{0};
uint32 curhealth{0};
uint32 curmana{0};
uint8 movementType{0};
uint8 spawnMask{0};
uint32 npcflag{0};
uint32 unit_flags{0}; // enum UnitFlags mask values
uint32 dynamicflags{0};
bool dbData{true};
bool overwrittenZ{false};
};
struct CreatureModelInfo
@@ -388,17 +385,17 @@ typedef std::list<VendorItemCount> VendorItemCounts;
struct TrainerSpell
{
TrainerSpell() : spell(0), spellCost(0), reqSkill(0), reqSkillValue(0), reqLevel(0)
TrainerSpell()
{
for (unsigned int & i : learnedSpell)
i = 0;
}
uint32 spell;
uint32 spellCost;
uint32 reqSkill;
uint32 reqSkillValue;
uint32 reqLevel;
uint32 spell{0};
uint32 spellCost{0};
uint32 reqSkill{0};
uint32 reqSkillValue{0};
uint32 reqLevel{0};
uint32 learnedSpell[3];
// helpers
@@ -409,11 +406,11 @@ typedef std::unordered_map<uint32 /*spellid*/, TrainerSpell> TrainerSpellMap;
struct TrainerSpellData
{
TrainerSpellData() : trainerType(0) {}
TrainerSpellData() {}
~TrainerSpellData() { spellList.clear(); }
TrainerSpellMap spellList;
uint32 trainerType; // trainer type based at trainer spells, can be different from creature_template value.
uint32 trainerType{0}; // trainer type based at trainer spells, can be different from creature_template value.
// req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2.
[[nodiscard]] TrainerSpell const* Find(uint32 spell_id) const;
};

View File

@@ -688,22 +688,21 @@ enum GOState
// from `gameobject`
struct GameObjectData
{
explicit GameObjectData() : id(0), mapid(0), phaseMask(0), posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0),
animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), dbData(true) { }
uint32 id; // entry in gamobject_template
uint16 mapid;
uint32 phaseMask;
float posX;
float posY;
float posZ;
float orientation;
explicit GameObjectData() { }
uint32 id{0}; // entry in gamobject_template
uint16 mapid{0};
uint32 phaseMask{0};
float posX{0.0f};
float posY{0.0f};
float posZ{0.0f};
float orientation{0.0f};
G3D::Quat rotation;
int32 spawntimesecs;
uint32 animprogress;
GOState go_state;
uint8 spawnMask;
uint8 artKit;
bool dbData;
int32 spawntimesecs{0};
uint32 animprogress{0};
GOState go_state{GO_STATE_ACTIVE};
uint8 spawnMask{0};
uint8 artKit{0};
bool dbData{true};
};
typedef std::vector<uint32> GameObjectQuestItemList;

View File

@@ -597,11 +597,11 @@ ByteBuffer& operator >> (ByteBuffer& buf, Position::PositionXYZOStreamer const&
struct MovementInfo
{
// common
uint64 guid;
uint32 flags;
uint16 flags2;
uint64 guid{0};
uint32 flags{0};
uint16 flags2{0};
Position pos;
uint32 time;
uint32 time{0};
// transport
struct TransportInfo
@@ -623,10 +623,10 @@ struct MovementInfo
} transport;
// swimming/flying
float pitch;
float pitch{0.0f};
// falling
uint32 fallTime;
uint32 fallTime{0};
// jumping
struct JumpInfo
@@ -641,10 +641,9 @@ struct MovementInfo
} jump;
// spline
float splineElevation;
float splineElevation{0.0f};
MovementInfo() :
guid(0), flags(0), flags2(0), time(0), pitch(0.0f), fallTime(0), splineElevation(0.0f)
MovementInfo()
{
pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
transport.Reset();
@@ -749,14 +748,14 @@ class MovableMapObject
template<class T> friend class RandomMovementGenerator;
protected:
MovableMapObject() : _moveState(MAP_OBJECT_CELL_MOVE_NONE) {}
MovableMapObject() {}
private:
[[nodiscard]] Cell const& GetCurrentCell() const { return _currentCell; }
void SetCurrentCell(Cell const& cell) { _currentCell = cell; }
Cell _currentCell;
MapObjectCellMoveState _moveState;
MapObjectCellMoveState _moveState{MAP_OBJECT_CELL_MOVE_NONE};
};
class WorldObject : public Object, public WorldLocation

View File

@@ -22,7 +22,7 @@ public:
CLIENT_UPDATE_MASK_BITS = sizeof(ClientUpdateMaskType) * 8,
};
UpdateMask() : _fieldCount(0), _blockCount(0), _bits(nullptr) { }
UpdateMask() { }
UpdateMask(UpdateMask const& right) : _bits(nullptr)
{
@@ -105,9 +105,9 @@ public:
}
private:
uint32 _fieldCount;
uint32 _blockCount;
uint8* _bits;
uint32 _fieldCount{0};
uint32 _blockCount{0};
uint8* _bits{nullptr};
};
#endif

View File

@@ -143,13 +143,13 @@ enum TalentTree // talent tabs
// Spell modifier (used for modify other spells)
struct SpellModifier
{
SpellModifier(Aura* _ownerAura = nullptr) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), value(0), mask(), spellId(0), ownerAura(_ownerAura) {}
SpellModifier(Aura* _ownerAura = nullptr) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), mask(), ownerAura(_ownerAura) {}
SpellModOp op : 8;
SpellModType type : 8;
int16 charges : 16;
int32 value;
int32 value{0};
flag96 mask;
uint32 spellId;
uint32 spellId{0};
Aura* const ownerAura;
};
@@ -214,10 +214,10 @@ enum ReputationSource
struct ActionButton
{
ActionButton() : packedData(0), uState(ACTIONBUTTON_NEW) {}
ActionButton() {}
uint32 packedData;
ActionButtonUpdateState uState;
uint32 packedData{0};
ActionButtonUpdateState uState{ACTIONBUTTON_NEW};
// helpers
[[nodiscard]] ActionButtonType GetType() const { return ActionButtonType(ACTION_BUTTON_TYPE(packedData)); }
@@ -250,16 +250,16 @@ typedef std::list<PlayerCreateInfoItem> PlayerCreateInfoItems;
struct PlayerClassLevelInfo
{
PlayerClassLevelInfo() : basehealth(0), basemana(0) {}
uint16 basehealth;
uint16 basemana;
PlayerClassLevelInfo() {}
uint16 basehealth{0};
uint16 basemana{0};
};
struct PlayerClassInfo
{
PlayerClassInfo() : levelInfo(nullptr) { }
PlayerClassInfo() { }
PlayerClassLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1
PlayerClassLevelInfo* levelInfo{nullptr}; //[level-1] 0..MaxPlayerLevel-1
};
struct PlayerLevelInfo
@@ -273,12 +273,12 @@ typedef std::list<uint32> PlayerCreateInfoSpells;
struct PlayerCreateInfoAction
{
PlayerCreateInfoAction() : button(0), type(0), action(0) {}
PlayerCreateInfoAction() {}
PlayerCreateInfoAction(uint8 _button, uint32 _action, uint8 _type) : button(_button), type(_type), action(_action) {}
uint8 button;
uint8 type;
uint32 action;
uint8 button{0};
uint8 type{0};
uint32 action{0};
};
typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions;
@@ -286,44 +286,44 @@ typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions;
struct PlayerInfo
{
// existence checked by displayId != 0
PlayerInfo() : mapId(0), areaId(0), positionX(0.0f), positionY(0.0f), positionZ(0.0f), orientation(0.0f), displayId_m(0), displayId_f(0), levelInfo(nullptr) { }
PlayerInfo() { }
uint32 mapId;
uint32 areaId;
float positionX;
float positionY;
float positionZ;
float orientation;
uint16 displayId_m;
uint16 displayId_f;
uint32 mapId{0};
uint32 areaId{0};
float positionX{0.0f};
float positionY{0.0f};
float positionZ{0.0f};
float orientation{0.0f};
uint16 displayId_m{0};
uint16 displayId_f{0};
PlayerCreateInfoItems item;
PlayerCreateInfoSpells spell;
PlayerCreateInfoActions action;
PlayerLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1
PlayerLevelInfo* levelInfo{nullptr}; //[level-1] 0..MaxPlayerLevel-1
};
struct PvPInfo
{
PvPInfo() : IsHostile(false), IsInHostileArea(false), IsInNoPvPArea(false), IsInFFAPvPArea(false), EndTimer(0) {}
PvPInfo() {}
bool IsHostile;
bool IsInHostileArea; ///> Marks if player is in an area which forces PvP flag
bool IsInNoPvPArea; ///> Marks if player is in a sanctuary or friendly capital city
bool IsInFFAPvPArea; ///> Marks if player is in an FFAPvP area (such as Gurubashi Arena)
time_t EndTimer; ///> Time when player unflags himself for PvP (flag removed after 5 minutes)
bool IsHostile{false};
bool IsInHostileArea{false}; ///> Marks if player is in an area which forces PvP flag
bool IsInNoPvPArea{false}; ///> Marks if player is in a sanctuary or friendly capital city
bool IsInFFAPvPArea{false}; ///> Marks if player is in an FFAPvP area (such as Gurubashi Arena)
time_t EndTimer{0}; ///> Time when player unflags himself for PvP (flag removed after 5 minutes)
};
struct DuelInfo
{
DuelInfo() : initiator(nullptr), opponent(nullptr), startTimer(0), startTime(0), outOfBound(0), isMounted(false) {}
DuelInfo() {}
Player* initiator;
Player* opponent;
time_t startTimer;
time_t startTime;
time_t outOfBound;
bool isMounted;
Player* initiator{nullptr};
Player* opponent{nullptr};
time_t startTimer{0};
time_t startTime{0};
time_t outOfBound{0};
bool isMounted{false};
};
struct Areas
@@ -380,13 +380,13 @@ struct Runes
struct EnchantDuration
{
EnchantDuration() : item(nullptr), slot(MAX_ENCHANTMENT_SLOT), leftduration(0) {};
EnchantDuration() {};
EnchantDuration(Item* _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot),
leftduration(_leftduration) { ASSERT(item); };
Item* item;
EnchantmentSlot slot;
uint32 leftduration;
Item* item{nullptr};
EnchantmentSlot slot{MAX_ENCHANTMENT_SLOT};
uint32 leftduration{0};
};
typedef std::list<EnchantDuration> EnchantDurationList;
@@ -687,18 +687,18 @@ enum EquipmentSetUpdateState
struct EquipmentSet
{
EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW)
EquipmentSet()
{
for (unsigned int & Item : Items)
Item = 0;
}
uint64 Guid;
uint64 Guid{0};
std::string Name;
std::string IconName;
uint32 IgnoreMask;
uint32 IgnoreMask{0};
uint32 Items[EQUIPMENT_SLOT_END];
EquipmentSetUpdateState state;
EquipmentSetUpdateState state{EQUIPMENT_SET_NEW};
};
#define MAX_EQUIPMENT_SET_INDEX 10 // client limit
@@ -1019,29 +1019,29 @@ class Player;
// holder for Battleground data (pussywizard: not stored in db)
struct BGData
{
BGData() : bgInstanceID(0), bgTypeID(BATTLEGROUND_TYPE_NONE), bgTeamId(TEAM_NEUTRAL), bgQueueSlot(PLAYER_MAX_BATTLEGROUND_QUEUES), isInvited(false), bgIsRandom(false), bgAfkReportedCount(0), bgAfkReportedTimer(0) {}
BGData() {}
uint32 bgInstanceID;
BattlegroundTypeId bgTypeID;
TeamId bgTeamId;
uint32 bgQueueSlot;
bool isInvited;
bool bgIsRandom;
uint32 bgInstanceID{0};
BattlegroundTypeId bgTypeID{BATTLEGROUND_TYPE_NONE};
TeamId bgTeamId{TEAM_NEUTRAL};
uint32 bgQueueSlot{PLAYER_MAX_BATTLEGROUND_QUEUES};
bool isInvited{false};
bool bgIsRandom{false};
std::set<uint32> bgAfkReporter;
uint8 bgAfkReportedCount;
time_t bgAfkReportedTimer;
uint8 bgAfkReportedCount{0};
time_t bgAfkReportedTimer{0};
};
// holder for Entry Point data (pussywizard: stored in db)
struct EntryPointData
{
EntryPointData() : mountSpell(0)
EntryPointData()
{
ClearTaxiPath();
}
uint32 mountSpell;
uint32 mountSpell{0};
std::vector<uint32> taxiPath;
WorldLocation joinPos;

View File

@@ -1026,9 +1026,9 @@ uint32 createProcExtendMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missC
struct RedirectThreatInfo
{
RedirectThreatInfo() : _targetGUID(0), _threatPct(0) { }
uint64 _targetGUID;
uint32 _threatPct;
RedirectThreatInfo() { }
uint64 _targetGUID{0};
uint32 _threatPct{0};
[[nodiscard]] uint64 GetTargetGUID() const { return _targetGUID; }
[[nodiscard]] uint32 GetThreatPct() const { return _threatPct; }