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

@@ -69,7 +69,7 @@ class Unit;
struct AchievementCriteriaData
{
AchievementCriteriaDataType dataType;
AchievementCriteriaDataType dataType{ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE};
union
{
// ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE = 0 (no data)
@@ -186,7 +186,7 @@ struct AchievementCriteriaData
};
uint32 ScriptId;
AchievementCriteriaData() : dataType(ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE)
AchievementCriteriaData()
{
raw.value1 = 0;
raw.value2 = 0;
@@ -206,13 +206,13 @@ struct AchievementCriteriaData
struct AchievementCriteriaDataSet
{
AchievementCriteriaDataSet() : criteria_id(0) {}
AchievementCriteriaDataSet() {}
typedef std::vector<AchievementCriteriaData> Storage;
void Add(AchievementCriteriaData const& data) { storage.push_back(data); }
bool Meets(Player const* source, Unit const* target, uint32 miscvalue = 0) const;
void SetCriteriaId(uint32 id) {criteria_id = id;}
private:
uint32 criteria_id;
uint32 criteria_id{0};
Storage storage;
};

View File

@@ -174,11 +174,11 @@ enum BattlegroundTeams
struct BattlegroundObjectInfo
{
BattlegroundObjectInfo() : object(nullptr), timer(0), spellid(0) {}
BattlegroundObjectInfo() {}
GameObject* object;
int32 timer;
uint32 spellid;
GameObject* object{nullptr};
int32 timer{0};
uint32 spellid{0};
};
enum ScoreType
@@ -273,7 +273,7 @@ struct BattlegroundScore
class ArenaLogEntryData
{
public:
ArenaLogEntryData() : Guid(0), ArenaTeamId(0), DamageDone(0), HealingDone(0), KillingBlows(0) {}
ArenaLogEntryData() {}
void Fill(const char* name, uint32 guid, uint32 acc, uint32 arenaTeamId, std::string ip)
{
Name = std::string(name);
@@ -284,13 +284,13 @@ public:
}
std::string Name;
uint32 Guid;
uint32 Guid{0};
uint32 Acc;
uint32 ArenaTeamId;
uint32 ArenaTeamId{0};
std::string IP;
uint32 DamageDone;
uint32 HealingDone;
uint32 KillingBlows;
uint32 DamageDone{0};
uint32 HealingDone{0};
uint32 KillingBlows{0};
};
enum BGHonorMode

View File

@@ -128,7 +128,7 @@ class ThreatContainer
public:
typedef std::list<HostileReference*> StorageType;
ThreatContainer(): iDirty(false) { }
ThreatContainer() { }
~ThreatContainer() { clearReferences(); }
@@ -173,7 +173,7 @@ private:
void update();
StorageType iThreatList;
bool iDirty;
bool iDirty{false};
};
//=================================================

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; }

View File

@@ -41,15 +41,15 @@ typedef std::map<uint32 /*condition id*/, GameEventFinishCondition> GameEventCon
struct GameEventData
{
GameEventData() : start(1), end(0), nextstart(0), occurence(0), length(0), holiday_id(HOLIDAY_NONE), state(GAMEEVENT_NORMAL) { }
time_t start; // occurs after this time
time_t end; // occurs before this time
time_t nextstart; // after this time the follow-up events count this phase completed
uint32 occurence; // time between end and start
uint32 length; // length of the event (minutes) after finishing all conditions
HolidayIds holiday_id;
GameEventData() { }
time_t start{1}; // occurs after this time
time_t end{0}; // occurs before this time
time_t nextstart{0}; // after this time the follow-up events count this phase completed
uint32 occurence{0}; // time between end and start
uint32 length{0}; // length of the event (minutes) after finishing all conditions
HolidayIds holiday_id{HOLIDAY_NONE};
uint8 holidayStage;
GameEventState state; // state of the game event, these are saved into the game_event table on change!
GameEventState state{GAMEEVENT_NORMAL}; // state of the game event, these are saved into the game_event table on change!
GameEventConditionMap conditions; // conditions to finish
std::set<uint16 /*gameevent id*/> prerequisite_events; // events that must be completed before starting this event
std::string description;

View File

@@ -421,26 +421,25 @@ struct AreaTrigger
struct BroadcastText
{
BroadcastText() : Id(0), Language(0), EmoteId0(0), EmoteId1(0), EmoteId2(0),
EmoteDelay0(0), EmoteDelay1(0), EmoteDelay2(0), SoundId(0), Unk1(0), Unk2(0)
BroadcastText()
{
MaleText.resize(DEFAULT_LOCALE + 1);
FemaleText.resize(DEFAULT_LOCALE + 1);
}
uint32 Id;
uint32 Language;
uint32 Id{0};
uint32 Language{0};
StringVector MaleText;
StringVector FemaleText;
uint32 EmoteId0;
uint32 EmoteId1;
uint32 EmoteId2;
uint32 EmoteDelay0;
uint32 EmoteDelay1;
uint32 EmoteDelay2;
uint32 SoundId;
uint32 Unk1;
uint32 Unk2;
uint32 EmoteId0{0};
uint32 EmoteId1{0};
uint32 EmoteId2{0};
uint32 EmoteDelay0{0};
uint32 EmoteDelay1{0};
uint32 EmoteDelay2{0};
uint32 SoundId{0};
uint32 Unk1{0};
uint32 Unk2{0};
// uint32 VerifiedBuild;
[[nodiscard]] std::string const& GetText(LocaleConstant locale = DEFAULT_LOCALE, uint8 gender = GENDER_MALE, bool forceGender = false) const
@@ -511,24 +510,24 @@ typedef std::pair<QuestRelations::const_iterator, QuestRelations::const_iterator
struct PetLevelInfo
{
PetLevelInfo() : health(0), mana(0), armor(0), min_dmg(0), max_dmg(0) { for (unsigned short & stat : stats) stat = 0; }
PetLevelInfo() { for (unsigned short & stat : stats) stat = 0; }
uint16 stats[MAX_STATS];
uint16 health;
uint16 mana;
uint32 armor;
uint16 min_dmg;
uint16 max_dmg;
uint16 health{0};
uint16 mana{0};
uint32 armor{0};
uint16 min_dmg{0};
uint16 max_dmg{0};
};
struct MailLevelReward
{
MailLevelReward() : raceMask(0), mailTemplateId(0), senderEntry(0) {}
MailLevelReward() {}
MailLevelReward(uint32 _raceMask, uint32 _mailTemplateId, uint32 _senderEntry) : raceMask(_raceMask), mailTemplateId(_mailTemplateId), senderEntry(_senderEntry) {}
uint32 raceMask;
uint32 mailTemplateId;
uint32 senderEntry;
uint32 raceMask{0};
uint32 mailTemplateId{0};
uint32 senderEntry{0};
};
typedef std::list<MailLevelReward> MailLevelRewardList;
@@ -611,25 +610,25 @@ typedef std::pair<GossipMenuItemsContainer::iterator, GossipMenuItemsContainer::
struct QuestPOIPoint
{
int32 x;
int32 y;
int32 x{0};
int32 y{0};
QuestPOIPoint() : x(0), y(0) {}
QuestPOIPoint() {}
QuestPOIPoint(int32 _x, int32 _y) : x(_x), y(_y) {}
};
struct QuestPOI
{
uint32 Id;
int32 ObjectiveIndex;
uint32 MapId;
uint32 AreaId;
uint32 FloorId;
uint32 Unk3;
uint32 Unk4;
uint32 Id{0};
int32 ObjectiveIndex{0};
uint32 MapId{0};
uint32 AreaId{0};
uint32 FloorId{0};
uint32 Unk3{0};
uint32 Unk4{0};
std::vector<QuestPOIPoint> points;
QuestPOI() : Id(0), ObjectiveIndex(0), MapId(0), AreaId(0), FloorId(0), Unk3(0), Unk4(0) {}
QuestPOI() {}
QuestPOI(uint32 id, int32 objIndex, uint32 mapId, uint32 areaId, uint32 floorId, uint32 unk3, uint32 unk4) : Id(id), ObjectiveIndex(objIndex), MapId(mapId), AreaId(areaId), FloorId(floorId), Unk3(unk3), Unk4(unk4) {}
};

View File

@@ -15,12 +15,12 @@ class Player;
class GroupReference : public Reference<Group, Player>
{
protected:
uint8 iSubGroup;
uint8 iSubGroup{0};
void targetObjectBuildLink() override;
void targetObjectDestroyLink() override;
void sourceObjectDestroyLink() override;
public:
GroupReference() : Reference<Group, Player>(), iSubGroup(0) {}
GroupReference() : Reference<Group, Player>() {}
~GroupReference() override { unlink(); }
GroupReference* next() { return (GroupReference*)Reference<Group, Player>::next(); }
[[nodiscard]] GroupReference const* next() const { return (GroupReference const*)Reference<Group, Player>::next(); }

View File

@@ -27,10 +27,10 @@ class InstanceSave;
struct InstancePlayerBind
{
InstanceSave* save;
InstanceSave* save{nullptr};
bool perm : 1;
bool extended : 1;
InstancePlayerBind() : save(nullptr), perm(false), extended(false) {}
InstancePlayerBind() : perm(false), extended(false) {}
};
typedef std::unordered_map< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap;
@@ -101,7 +101,7 @@ class InstanceSaveManager
friend class InstanceSave;
private:
InstanceSaveManager() : lock_instLists(false) {};
InstanceSaveManager() {};
~InstanceSaveManager();
public:
@@ -111,11 +111,11 @@ public:
struct InstResetEvent
{
uint8 type; // 0 - unused, 1-4 warnings about pending reset, 5 - reset
uint8 type{0}; // 0 - unused, 1-4 warnings about pending reset, 5 - reset
Difficulty difficulty: 8;
uint16 mapid;
uint16 mapid{0};
InstResetEvent() : type(0), difficulty(DUNGEON_DIFFICULTY_NORMAL), mapid(0) {}
InstResetEvent() : difficulty(DUNGEON_DIFFICULTY_NORMAL) {}
InstResetEvent(uint8 t, uint32 _mapid, Difficulty d)
: type(t), difficulty(d), mapid(_mapid) {}
};
@@ -183,7 +183,7 @@ protected:
private:
void _ResetOrWarnAll(uint32 mapid, Difficulty difficulty, bool warn, time_t resetTime);
void _ResetSave(InstanceSaveHashMap::iterator& itr);
bool lock_instLists;
bool lock_instLists{false};
InstanceSaveHashMap m_instanceSaveById;
ResetTimeByMapDifficultyMap m_resetTimeByMapDifficulty;
ResetTimeByMapDifficultyMap m_resetExtendedTimeByMapDifficulty;

View File

@@ -170,11 +170,11 @@ struct LootItem
struct QuestItem
{
uint8 index; // position in quest_items;
bool is_looted;
uint8 index{0}; // position in quest_items;
bool is_looted{false};
QuestItem()
: index(0), is_looted(false) {}
{}
QuestItem(uint8 _index, bool _islooted = false)
: index(_index), is_looted(_islooted) {}
@@ -306,14 +306,14 @@ struct Loot
std::vector<LootItem> items;
std::vector<LootItem> quest_items;
uint32 gold;
uint8 unlootedCount;
uint64 roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
LootType loot_type; // required for achievement system
uint8 unlootedCount{0};
uint64 roundRobinPlayer{0}; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
LootType loot_type{LOOT_NONE}; // required for achievement system
// GUIDLow of container that holds this loot (item_instance.entry), set for items that can be looted
uint32 containerId;
uint32 containerId{0};
Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), roundRobinPlayer(0), loot_type(LOOT_NONE), containerId(0) { }
Loot(uint32 _gold = 0) : gold(_gold) { }
~Loot() { clear(); }
// if loot becomes invalid this reference is used to inform the listener

View File

@@ -237,14 +237,13 @@ enum LevelRequirementVsMode
struct ZoneDynamicInfo
{
ZoneDynamicInfo() : MusicId(0), WeatherId(0), WeatherGrade(0.0f),
OverrideLightId(0), LightFadeInTime(0) { }
ZoneDynamicInfo() { }
uint32 MusicId;
uint32 WeatherId;
float WeatherGrade;
uint32 OverrideLightId;
uint32 LightFadeInTime;
uint32 MusicId{0};
uint32 WeatherId{0};
float WeatherGrade{0.0f};
uint32 OverrideLightId{0};
uint32 LightFadeInTime{0};
};
#if defined(__GNUC__)

View File

@@ -3569,15 +3569,14 @@ enum PartyResult
struct MmapTileHeader
{
uint32 mmapMagic;
uint32 mmapMagic{MMAP_MAGIC};
uint32 dtVersion;
uint32 mmapVersion;
uint32 size;
char usesLiquids;
char padding[3];
uint32 mmapVersion{MMAP_VERSION};
uint32 size{0};
char usesLiquids{true};
char padding[3]{};
MmapTileHeader() : mmapMagic(MMAP_MAGIC), dtVersion(DT_NAVMESH_VERSION),
mmapVersion(MMAP_VERSION), size(0), usesLiquids(true), padding() { }
MmapTileHeader() : dtVersion(DT_NAVMESH_VERSION) { }
};
// All padding fields must be handled and initialized to ensure mmaps_generator will produce binary-identical *.mmtile files

View File

@@ -14,12 +14,12 @@ namespace Movement
{
struct Location : public Vector3
{
Location() : orientation(0) {}
Location() {}
Location(float x, float y, float z, float o) : Vector3(x, y, z), orientation(o) {}
Location(const Vector3& v) : Vector3(v), orientation(0) {}
Location(const Vector3& v, float o) : Vector3(v), orientation(o) {}
float orientation;
float orientation{0};
};
// MoveSpline represents smooth catmullrom or linear curve and point that moves belong it

View File

@@ -32,9 +32,7 @@ namespace Movement
struct MoveSplineInitArgs
{
MoveSplineInitArgs(size_t path_capacity = 16) : path_Idx_offset(0), velocity(0.f),
parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f),
HasVelocity(false), TransformForTransport(true)
MoveSplineInitArgs(size_t path_capacity = 16)
{
path.reserve(path_capacity);
}
@@ -42,14 +40,14 @@ namespace Movement
PointsArray path;
FacingInfo facing;
MoveSplineFlag flags;
int32 path_Idx_offset;
float velocity;
float parabolic_amplitude;
float time_perc;
uint32 splineId;
float initialOrientation;
bool HasVelocity;
bool TransformForTransport;
int32 path_Idx_offset{0};
float velocity{0.f};
float parabolic_amplitude{0.f};
float time_perc{0.f};
uint32 splineId{0};
float initialOrientation{0.f};
bool HasVelocity{false};
bool TransformForTransport{true};
/** Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed. */
bool Validate(Unit* unit) const;

View File

@@ -33,11 +33,11 @@ namespace Movement
ControlArray points;
ControlArray pointsVisual;
index_type index_lo;
index_type index_hi;
index_type index_lo{0};
index_type index_hi{0};
uint8 m_mode;
bool cyclic;
uint8 m_mode{UninitializedMode};
bool cyclic{false};
enum
{
@@ -79,7 +79,7 @@ namespace Movement
public:
explicit SplineBase() : index_lo(0), index_hi(0), m_mode(UninitializedMode), cyclic(false) {}
explicit SplineBase() {}
/** Caclulates the position for given segment Idx, and percent of segment length t
@param t - percent of segment length, assumes that t in range [0, 1]

View File

@@ -388,17 +388,17 @@ protected:
struct QuestStatusData
{
QuestStatusData(): Status(QUEST_STATUS_NONE), Timer(0), PlayerCount(0), Explored(false)
QuestStatusData()
{
memset(ItemCount, 0, QUEST_ITEM_OBJECTIVES_COUNT * sizeof(uint16));
memset(CreatureOrGOCount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint16));
}
QuestStatus Status;
uint32 Timer;
QuestStatus Status{QUEST_STATUS_NONE};
uint32 Timer{0};
uint16 ItemCount[QUEST_ITEM_OBJECTIVES_COUNT];
uint16 CreatureOrGOCount[QUEST_OBJECTIVES_COUNT];
uint16 PlayerCount;
bool Explored;
uint16 PlayerCount{0};
bool Explored{false};
};
#endif

View File

@@ -75,9 +75,9 @@ enum AccountDataType
struct AccountData
{
AccountData() : Time(0), Data("") {}
AccountData() : Data("") {}
time_t Time;
time_t Time{0};
std::string Data;
};

View File

@@ -444,7 +444,7 @@ private:
typedef std::unordered_map<uint32, uint32> PetAuraMap;
public:
PetAura() : removeOnChangePet(false), damage(0)
PetAura()
{
auras.clear();
}
@@ -483,8 +483,8 @@ public:
private:
PetAuraMap auras;
bool removeOnChangePet;
int32 damage;
bool removeOnChangePet{false};
int32 damage{0};
};
typedef std::map<uint32, PetAura> SpellPetAuraMap;