diff --git a/src/common/Collision/BoundingIntervalHierarchy.h b/src/common/Collision/BoundingIntervalHierarchy.h index d64e551eb..7bdf5637e 100644 --- a/src/common/Collision/BoundingIntervalHierarchy.h +++ b/src/common/Collision/BoundingIntervalHierarchy.h @@ -352,22 +352,19 @@ protected: class BuildStats { private: - int numNodes; - int numLeaves; - int sumObjects; - int minObjects; - int maxObjects; - int sumDepth; - int minDepth; - int maxDepth; + int numNodes{0}; + int numLeaves{0}; + int sumObjects{0}; + int minObjects{0x0FFFFFFF}; + int maxObjects{-1}; // 0xFFFFFFFF + int sumDepth{0}; + int minDepth{0x0FFFFFFF}; + int maxDepth{-1}; // 0xFFFFFFFF int numLeavesN[6]; - int numBVH2; + int numBVH2{0}; public: - BuildStats(): - numNodes(0), numLeaves(0), sumObjects(0), minObjects(0x0FFFFFFF), - maxObjects(0xFFFFFFFF), sumDepth(0), minDepth(0x0FFFFFFF), - maxDepth(0xFFFFFFFF), numBVH2(0) + BuildStats() { for (int & i : numLeavesN) i = 0; } diff --git a/src/common/Collision/Management/IVMapManager.h b/src/common/Collision/Management/IVMapManager.h index 581320cfd..ea705e2ae 100644 --- a/src/common/Collision/Management/IVMapManager.h +++ b/src/common/Collision/Management/IVMapManager.h @@ -33,11 +33,11 @@ namespace VMAP class IVMapManager { private: - bool iEnableLineOfSightCalc; - bool iEnableHeightCalc; + bool iEnableLineOfSightCalc{true}; + bool iEnableHeightCalc{true}; public: - IVMapManager() : iEnableLineOfSightCalc(true), iEnableHeightCalc(true) { } + IVMapManager() { } virtual ~IVMapManager() = default; diff --git a/src/common/Collision/Management/VMapManager2.h b/src/common/Collision/Management/VMapManager2.h index 2953bb3f5..4235963b2 100644 --- a/src/common/Collision/Management/VMapManager2.h +++ b/src/common/Collision/Management/VMapManager2.h @@ -52,14 +52,14 @@ namespace VMAP class ManagedModel { public: - ManagedModel() : iModel(nullptr), iRefCount(0) { } + ManagedModel() { } void setModel(WorldModel* model) { iModel = model; } WorldModel* getModel() { return iModel; } void incRefCount() { ++iRefCount; } int decRefCount() { return --iRefCount; } protected: - WorldModel* iModel; - int iRefCount; + WorldModel* iModel{nullptr}; + int iRefCount{0}; }; typedef std::unordered_map InstanceTreeMap; diff --git a/src/common/Collision/Maps/MapTree.h b/src/common/Collision/Maps/MapTree.h index 4ea5f0abd..8680791e3 100644 --- a/src/common/Collision/Maps/MapTree.h +++ b/src/common/Collision/Maps/MapTree.h @@ -19,9 +19,9 @@ namespace VMAP struct LocationInfo { - LocationInfo(): hitInstance(nullptr), hitModel(nullptr), ground_Z(-G3D::inf()) { } - const ModelInstance* hitInstance; - const GroupModel* hitModel; + LocationInfo(): ground_Z(-G3D::inf()) { } + const ModelInstance* hitInstance{nullptr}; + const GroupModel* hitModel{nullptr}; float ground_Z; }; @@ -73,14 +73,13 @@ namespace VMAP struct AreaInfo { - AreaInfo(): result(false), ground_Z(-G3D::inf()), flags(0), adtId(0), - rootId(0), groupId(0) { } - bool result; + AreaInfo(): ground_Z(-G3D::inf()) { } + bool result{false}; float ground_Z; - uint32 flags; - int32 adtId; - int32 rootId; - int32 groupId; + uint32 flags{0}; + int32 adtId{0}; + int32 rootId{0}; + int32 groupId{0}; }; } // VMAP diff --git a/src/common/Collision/Maps/TileAssembler.h b/src/common/Collision/Maps/TileAssembler.h index 20219c814..9d0bfc611 100644 --- a/src/common/Collision/Maps/TileAssembler.h +++ b/src/common/Collision/Maps/TileAssembler.h @@ -28,10 +28,10 @@ namespace VMAP private: G3D::Matrix3 iRotation; public: - ModelPosition(): iScale(0.0f) { } + ModelPosition() { } G3D::Vector3 iPos; G3D::Vector3 iDir; - float iScale; + float iScale{0.0f}; void init() { iRotation = G3D::Matrix3::fromEulerAnglesZYX(G3D::pif() * iDir.y / 180.f, G3D::pif() * iDir.x / 180.f, G3D::pif() * iDir.z / 180.f); @@ -54,17 +54,18 @@ namespace VMAP struct GroupModel_Raw { - uint32 mogpflags; - uint32 GroupWMOID; + uint32 mogpflags{0}; + uint32 GroupWMOID{0}; G3D::AABox bounds; - uint32 liquidflags; + uint32 liquidflags{0}; std::vector triangles; std::vector vertexArray; class WmoLiquid* liquid; - GroupModel_Raw() : mogpflags(0), GroupWMOID(0), liquidflags(0), - liquid(nullptr) { } + + GroupModel_Raw() : liquid(nullptr) { } + ~GroupModel_Raw(); bool Read(FILE* f); diff --git a/src/common/Collision/Models/GameObjectModel.h b/src/common/Collision/Models/GameObjectModel.h index 59e1eb624..61182442d 100644 --- a/src/common/Collision/Models/GameObjectModel.h +++ b/src/common/Collision/Models/GameObjectModel.h @@ -24,17 +24,18 @@ struct GameObjectDisplayInfoEntry; class GameObjectModel /*, public Intersectable*/ { - uint32 phasemask; + uint32 phasemask{0}; G3D::AABox iBound; G3D::Matrix3 iInvRot; G3D::Vector3 iPos; //G3D::Vector3 iRot; - float iInvScale; - float iScale; + float iInvScale{0}; + float iScale{0}; VMAP::WorldModel* iModel; GameObject const* owner; - GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(nullptr), owner(nullptr) { } + + GameObjectModel() : iModel(nullptr), owner(nullptr) { } bool initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info); public: diff --git a/src/common/Collision/Models/ModelInstance.h b/src/common/Collision/Models/ModelInstance.h index a6701fca6..f51507bae 100644 --- a/src/common/Collision/Models/ModelInstance.h +++ b/src/common/Collision/Models/ModelInstance.h @@ -51,7 +51,7 @@ namespace VMAP class ModelInstance: public ModelSpawn { public: - ModelInstance(): iInvScale(0.0f), iModel(nullptr) { } + ModelInstance() { } ModelInstance(const ModelSpawn& spawn, WorldModel* model); void setUnloaded() { iModel = nullptr; } bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool StopAtFirstHit) const; @@ -60,8 +60,8 @@ namespace VMAP bool GetLiquidLevel(const G3D::Vector3& p, LocationInfo& info, float& liqHeight) const; protected: G3D::Matrix3 iInvRot; - float iInvScale; - WorldModel* iModel; + float iInvScale{0.0f}; + WorldModel* iModel{nullptr}; public: WorldModel* getWorldModel(); }; diff --git a/src/common/Collision/Models/WorldModel.h b/src/common/Collision/Models/WorldModel.h index 5e4ff18dc..cc05ae335 100644 --- a/src/common/Collision/Models/WorldModel.h +++ b/src/common/Collision/Models/WorldModel.h @@ -24,12 +24,12 @@ namespace VMAP class MeshTriangle { public: - MeshTriangle() : idx0(0), idx1(0), idx2(0) { } + MeshTriangle() { } MeshTriangle(uint32 na, uint32 nb, uint32 nc): idx0(na), idx1(nb), idx2(nc) { } - uint32 idx0; - uint32 idx1; - uint32 idx2; + uint32 idx0{0}; + uint32 idx1{0}; + uint32 idx2{0}; }; class WmoLiquid @@ -47,13 +47,13 @@ namespace VMAP bool writeToFile(FILE* wf); static bool readFromFile(FILE* rf, WmoLiquid*& liquid); private: - WmoLiquid(): iTilesX(0), iTilesY(0), iType(0), iHeight(nullptr), iFlags(nullptr) { } - uint32 iTilesX; //!< number of tiles in x direction, each - uint32 iTilesY; - G3D::Vector3 iCorner; //!< the lower corner - uint32 iType; //!< liquid type - float* iHeight; //!< (tilesX + 1)*(tilesY + 1) height values - uint8* iFlags; //!< info if liquid tile is used + WmoLiquid() { } + uint32 iTilesX{0}; //!< number of tiles in x direction, each + uint32 iTilesY{0}; + G3D::Vector3 iCorner; //!< the lower corner + uint32 iType{0}; //!< liquid type + float* iHeight{nullptr}; //!< (tilesX + 1)*(tilesY + 1) height values + uint8* iFlags{nullptr}; //!< info if liquid tile is used public: void getPosInfo(uint32& tilesX, uint32& tilesY, G3D::Vector3& corner) const; }; @@ -62,7 +62,7 @@ namespace VMAP class GroupModel { public: - GroupModel(): iMogpFlags(0), iGroupWMOID(0), iLiquid(nullptr) { } + GroupModel() { } GroupModel(const GroupModel& other); GroupModel(uint32 mogpFlags, uint32 groupWMOID, const G3D::AABox& bound): iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(nullptr) { } @@ -82,12 +82,12 @@ namespace VMAP [[nodiscard]] uint32 GetWmoID() const { return iGroupWMOID; } protected: G3D::AABox iBound; - uint32 iMogpFlags;// 0x8 outdor; 0x2000 indoor - uint32 iGroupWMOID; + uint32 iMogpFlags{0};// 0x8 outdor; 0x2000 indoor + uint32 iGroupWMOID{0}; std::vector vertices; std::vector triangles; BIH meshTree; - WmoLiquid* iLiquid; + WmoLiquid* iLiquid{nullptr}; public: void getMeshData(std::vector& vertices, std::vector& triangles, WmoLiquid*& liquid); }; @@ -95,7 +95,7 @@ namespace VMAP class WorldModel { public: - WorldModel(): RootWMOID(0) { } + WorldModel() { } //! pass group models to WorldModel and create BIH. Passed vector is swapped with old geometry! void setGroupModels(std::vector& models); @@ -106,7 +106,7 @@ namespace VMAP bool writeFile(const std::string& filename); bool readFile(const std::string& filename); protected: - uint32 RootWMOID; + uint32 RootWMOID{0}; std::vector groupModels; BIH groupTree; public: diff --git a/src/common/Database/Transaction.h b/src/common/Database/Transaction.h index 5425f4498..9d241ddbb 100644 --- a/src/common/Database/Transaction.h +++ b/src/common/Database/Transaction.h @@ -22,7 +22,7 @@ class Transaction friend class DatabaseWorkerPool; public: - Transaction() : _cleanedUp(false) { } + Transaction() { } ~Transaction() { Cleanup(); } void Append(PreparedStatement* statement); @@ -36,7 +36,7 @@ protected: std::list m_queries; private: - bool _cleanedUp; + bool _cleanedUp{false}; }; typedef std::shared_ptr SQLTransaction; diff --git a/src/common/Dynamic/LinkedList.h b/src/common/Dynamic/LinkedList.h index 5413421ab..717c59ec6 100644 --- a/src/common/Dynamic/LinkedList.h +++ b/src/common/Dynamic/LinkedList.h @@ -73,9 +73,9 @@ class LinkedListHead private: LinkedListElement iFirst; LinkedListElement iLast; - uint32 iSize; + uint32 iSize{0}; public: - LinkedListHead(): iSize(0) + LinkedListHead() { // create empty list diff --git a/src/common/Packets/ByteBuffer.h b/src/common/Packets/ByteBuffer.h index 2c81802d2..c58dc3231 100644 --- a/src/common/Packets/ByteBuffer.h +++ b/src/common/Packets/ByteBuffer.h @@ -53,7 +53,7 @@ public: const static size_t DEFAULT_SIZE = 0x1000; // constructor - ByteBuffer() : _rpos(0), _wpos(0) + ByteBuffer() { _storage.reserve(DEFAULT_SIZE); } @@ -503,7 +503,7 @@ public: void hexlike(bool outString = false) const; protected: - size_t _rpos, _wpos; + size_t _rpos{0}, _wpos{0}; std::vector _storage; }; diff --git a/src/common/Packets/WorldPacket.h b/src/common/Packets/WorldPacket.h index 9bf0b69ef..817083cd1 100644 --- a/src/common/Packets/WorldPacket.h +++ b/src/common/Packets/WorldPacket.h @@ -14,7 +14,7 @@ class WorldPacket : public ByteBuffer { public: // just container for later use - WorldPacket() : ByteBuffer(0), m_opcode(0) + WorldPacket() : ByteBuffer(0) { } explicit WorldPacket(uint16 opcode, size_t res = 200) : ByteBuffer(res), m_opcode(opcode) { } @@ -40,6 +40,6 @@ public: void SetOpcode(uint16 opcode) { m_opcode = opcode; } protected: - uint16 m_opcode; + uint16 m_opcode{0}; }; #endif diff --git a/src/common/Threading/LockedQueue.h b/src/common/Threading/LockedQueue.h index a89d4d1a9..6f53b90cd 100644 --- a/src/common/Threading/LockedQueue.h +++ b/src/common/Threading/LockedQueue.h @@ -25,13 +25,13 @@ namespace ACE_Based StorageType _queue; //! Cancellation flag. - volatile bool _canceled; + volatile bool _canceled{false}; public: //! Create a LockedQueue. LockedQueue() - : _canceled(false) + { } diff --git a/src/common/Utilities/Timer.h b/src/common/Utilities/Timer.h index b24c63bd5..3aa3e52d5 100644 --- a/src/common/Utilities/Timer.h +++ b/src/common/Utilities/Timer.h @@ -53,7 +53,7 @@ struct IntervalTimer public: IntervalTimer() - : _interval(0), _current(0) + { } @@ -97,8 +97,8 @@ public: private: - time_t _interval; - time_t _current; + time_t _interval{0}; + time_t _current{0}; }; struct TimeTracker diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h index c72574214..962e5600b 100644 --- a/src/common/Utilities/Util.h +++ b/src/common/Utilities/Util.h @@ -578,7 +578,7 @@ class EventMap typedef std::multimap EventStore; public: - EventMap() : _time(0), _phase(0), _lastEvent(0) { } + EventMap() { } /** * @name Reset @@ -908,9 +908,9 @@ public: } private: - uint32 _time; - uint32 _phase; - uint32 _lastEvent; + uint32 _time{0}; + uint32 _phase{0}; + uint32 _lastEvent{0}; EventStore _eventMap; }; diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h index 627c8943c..b4828b203 100644 --- a/src/server/game/Achievements/AchievementMgr.h +++ b/src/server/game/Achievements/AchievementMgr.h @@ -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 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; }; diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 3b7423ef9..438b0f204 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -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 diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h index 15744350f..cd7f3aba9 100644 --- a/src/server/game/Combat/ThreatManager.h +++ b/src/server/game/Combat/ThreatManager.h @@ -128,7 +128,7 @@ class ThreatContainer public: typedef std::list StorageType; - ThreatContainer(): iDirty(false) { } + ThreatContainer() { } ~ThreatContainer() { clearReferences(); } @@ -173,7 +173,7 @@ private: void update(); StorageType iThreatList; - bool iDirty; + bool iDirty{false}; }; //================================================= diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 0f1abaa94..4bf221545 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -251,31 +251,28 @@ typedef std::unordered_map 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 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 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; }; diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 87d00138d..de02f84c9 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -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 GameObjectQuestItemList; diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index cd68dd9b1..71f370e6f 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -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 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 diff --git a/src/server/game/Entities/Object/Updates/UpdateMask.h b/src/server/game/Entities/Object/Updates/UpdateMask.h index cab1d85fd..369de9a97 100644 --- a/src/server/game/Entities/Object/Updates/UpdateMask.h +++ b/src/server/game/Entities/Object/Updates/UpdateMask.h @@ -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 diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index c49fd205c..24f8a7f60 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -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 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 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 PlayerCreateInfoActions; @@ -286,44 +286,44 @@ typedef std::list 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 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 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 taxiPath; WorldLocation joinPos; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 9b73d3a1c..f5b5cc60f 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -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; } diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h index 0b5cc5310..467463b70 100644 --- a/src/server/game/Events/GameEventMgr.h +++ b/src/server/game/Events/GameEventMgr.h @@ -41,15 +41,15 @@ typedef std::map 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 prerequisite_events; // events that must be completed before starting this event std::string description; diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index ee9129d10..94d29aa5d 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -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 MailLevelRewardList; @@ -611,25 +610,25 @@ typedef std::pair 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) {} }; diff --git a/src/server/game/Groups/GroupReference.h b/src/server/game/Groups/GroupReference.h index 1aaedefe5..dba91a8bf 100644 --- a/src/server/game/Groups/GroupReference.h +++ b/src/server/game/Groups/GroupReference.h @@ -15,12 +15,12 @@ class Player; class GroupReference : public Reference { protected: - uint8 iSubGroup; + uint8 iSubGroup{0}; void targetObjectBuildLink() override; void targetObjectDestroyLink() override; void sourceObjectDestroyLink() override; public: - GroupReference() : Reference(), iSubGroup(0) {} + GroupReference() : Reference() {} ~GroupReference() override { unlink(); } GroupReference* next() { return (GroupReference*)Reference::next(); } [[nodiscard]] GroupReference const* next() const { return (GroupReference const*)Reference::next(); } diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h index 770069b6a..67a5267ab 100644 --- a/src/server/game/Instances/InstanceSaveMgr.h +++ b/src/server/game/Instances/InstanceSaveMgr.h @@ -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; diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index fc693d06b..4cadbe9d0 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -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 items; std::vector 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 diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index ad58f648b..8d722fa38 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -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__) diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 62eccbef9..5b65e4229 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -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 diff --git a/src/server/game/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h index 56283909a..03b66923e 100644 --- a/src/server/game/Movement/Spline/MoveSpline.h +++ b/src/server/game/Movement/Spline/MoveSpline.h @@ -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 diff --git a/src/server/game/Movement/Spline/MoveSplineInitArgs.h b/src/server/game/Movement/Spline/MoveSplineInitArgs.h index 4c113661c..076c67f0e 100644 --- a/src/server/game/Movement/Spline/MoveSplineInitArgs.h +++ b/src/server/game/Movement/Spline/MoveSplineInitArgs.h @@ -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; diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h index abfdf886c..a6d5c05e6 100644 --- a/src/server/game/Movement/Spline/Spline.h +++ b/src/server/game/Movement/Spline/Spline.h @@ -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] diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 0eac6a5bf..85c8c1dd5 100644 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -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 diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 5e9b273a5..ab49ec533 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -75,9 +75,9 @@ enum AccountDataType struct AccountData { - AccountData() : Time(0), Data("") {} + AccountData() : Data("") {} - time_t Time; + time_t Time{0}; std::string Data; }; diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index c8aee82d9..b3c341ff0 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -444,7 +444,7 @@ private: typedef std::unordered_map 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 SpellPetAuraMap; diff --git a/src/server/shared/DataStores/DBCStorageIterator.h b/src/server/shared/DataStores/DBCStorageIterator.h index 2dd013efb..525eb8dce 100644 --- a/src/server/shared/DataStores/DBCStorageIterator.h +++ b/src/server/shared/DataStores/DBCStorageIterator.h @@ -14,7 +14,7 @@ template class DBCStorageIterator : public std::iterator { public: - DBCStorageIterator() : _index(nullptr), _pos(0), _end(0) { } + DBCStorageIterator() : _index(nullptr) { } DBCStorageIterator(T** index, uint32 size, uint32 pos = 0) : _index(index), _pos(pos), _end(size) { if (_pos < _end) @@ -51,8 +51,8 @@ public: private: T** _index; - uint32 _pos; - uint32 _end; + uint32 _pos{0}; + uint32 _end{0}; }; #endif // DBCStorageIterator_h__ diff --git a/src/server/shared/DataStores/DBCStructure.h b/src/server/shared/DataStores/DBCStructure.h index d3cbf8899..ca9758e2b 100644 --- a/src/server/shared/DataStores/DBCStructure.h +++ b/src/server/shared/DataStores/DBCStructure.h @@ -2093,32 +2093,32 @@ struct WorldStateUI // Structures not used for casting to loaded DBC data and not required then packing struct MapDifficulty { - MapDifficulty() : resetTime(0), maxPlayers(0), hasErrorMessage(false) {} + MapDifficulty() {} MapDifficulty(uint32 _resetTime, uint32 _maxPlayers, bool _hasErrorMessage) : resetTime(_resetTime), maxPlayers(_maxPlayers), hasErrorMessage(_hasErrorMessage) {} - uint32 resetTime; - uint32 maxPlayers; - bool hasErrorMessage; + uint32 resetTime{0}; + uint32 maxPlayers{0}; + bool hasErrorMessage{false}; }; struct TalentSpellPos { - TalentSpellPos() : talent_id(0), rank(0) {} + TalentSpellPos() {} TalentSpellPos(uint16 _talent_id, uint8 _rank) : talent_id(_talent_id), rank(_rank) {} - uint16 talent_id; - uint8 rank; + uint16 talent_id{0}; + uint8 rank{0}; }; typedef std::map TalentSpellPosMap; struct TaxiPathBySourceAndDestination { - TaxiPathBySourceAndDestination() : ID(0), price(0) {} + TaxiPathBySourceAndDestination() {} TaxiPathBySourceAndDestination(uint32 _id, uint32 _price) : ID(_id), price(_price) {} - uint32 ID; - uint32 price; + uint32 ID{0}; + uint32 price{0}; }; typedef std::map TaxiPathSetForSource; typedef std::map TaxiPathSetBySource; diff --git a/src/server/shared/Network/RealmSocket.cpp b/src/server/shared/Network/RealmSocket.cpp index acaebbf91..ab190a81e 100644 --- a/src/server/shared/Network/RealmSocket.cpp +++ b/src/server/shared/Network/RealmSocket.cpp @@ -17,8 +17,8 @@ RealmSocket::Session::Session() = default; RealmSocket::Session::~Session() = default; RealmSocket::RealmSocket() : - input_buffer_(4096), session_(nullptr), - _remoteAddress(), _remotePort(0) + input_buffer_(4096), + _remoteAddress() { reference_counting_policy().value(ACE_Event_Handler::Reference_Counting_Policy::ENABLED); diff --git a/src/server/shared/Network/RealmSocket.h b/src/server/shared/Network/RealmSocket.h index 532faaca5..9d45ab9d9 100644 --- a/src/server/shared/Network/RealmSocket.h +++ b/src/server/shared/Network/RealmSocket.h @@ -59,9 +59,9 @@ private: ssize_t noblk_send(ACE_Message_Block& message_block); ACE_Message_Block input_buffer_; - Session* session_; + Session* session_{nullptr}; std::string _remoteAddress; - uint16 _remotePort; + uint16 _remotePort{0}; }; #endif /* __REALMSOCKET_H__ */ diff --git a/src/server/shared/Realms/RealmList.cpp b/src/server/shared/Realms/RealmList.cpp index 706002b7d..6a9065775 100644 --- a/src/server/shared/Realms/RealmList.cpp +++ b/src/server/shared/Realms/RealmList.cpp @@ -8,7 +8,7 @@ #include "RealmList.h" #include "DatabaseEnv.h" -RealmList::RealmList() : m_UpdateInterval(0), m_NextUpdateTime(time(nullptr)) { } +RealmList::RealmList() : m_NextUpdateTime(time(nullptr)) { } RealmList* RealmList::instance() { diff --git a/src/server/shared/Realms/RealmList.h b/src/server/shared/Realms/RealmList.h index 248c8dbd6..0bdf56907 100644 --- a/src/server/shared/Realms/RealmList.h +++ b/src/server/shared/Realms/RealmList.h @@ -63,7 +63,7 @@ private: void UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr const& address, ACE_INET_Addr const& localAddr, ACE_INET_Addr const& localSubmask, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build); RealmMap m_realms; - uint32 m_UpdateInterval; + uint32 m_UpdateInterval{0}; time_t m_NextUpdateTime; }; diff --git a/src/tools/mmaps_generator/IntermediateValues.h b/src/tools/mmaps_generator/IntermediateValues.h index d01372bb0..bd36eb793 100644 --- a/src/tools/mmaps_generator/IntermediateValues.h +++ b/src/tools/mmaps_generator/IntermediateValues.h @@ -17,14 +17,13 @@ namespace MMAP // this class gathers all debug info holding and output struct IntermediateValues { - rcHeightfield* heightfield; - rcCompactHeightfield* compactHeightfield; - rcContourSet* contours; - rcPolyMesh* polyMesh; - rcPolyMeshDetail* polyMeshDetail; + rcHeightfield* heightfield{nullptr}; + rcCompactHeightfield* compactHeightfield{nullptr}; + rcContourSet* contours{nullptr}; + rcPolyMesh* polyMesh{nullptr}; + rcPolyMeshDetail* polyMeshDetail{nullptr}; - IntermediateValues() : heightfield(nullptr), compactHeightfield(nullptr), - contours(nullptr), polyMesh(nullptr), polyMeshDetail(nullptr) {} + IntermediateValues() {} ~IntermediateValues(); void writeIV(uint32 mapID, uint32 tileX, uint32 tileY); diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp index 07f86229f..13800925b 100644 --- a/src/tools/mmaps_generator/MapBuilder.cpp +++ b/src/tools/mmaps_generator/MapBuilder.cpp @@ -25,15 +25,14 @@ namespace DisableMgr 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 @@ -50,7 +49,7 @@ namespace MMAP MapBuilder::MapBuilder(float maxWalkableAngle, bool skipLiquid, bool skipContinents, bool skipJunkMaps, bool skipBattlegrounds, bool debugOutput, bool bigBaseUnit, const char* offMeshFilePath) : - m_terrainBuilder (nullptr), + m_debugOutput (debugOutput), m_offMeshFilePath (offMeshFilePath), m_skipContinents (skipContinents), @@ -58,7 +57,7 @@ namespace MMAP m_skipBattlegrounds (skipBattlegrounds), m_maxWalkableAngle (maxWalkableAngle), m_bigBaseUnit (bigBaseUnit), - m_rcContext (nullptr), + _cancelationToken (false) { m_terrainBuilder = new TerrainBuilder(skipLiquid); diff --git a/src/tools/mmaps_generator/MapBuilder.h b/src/tools/mmaps_generator/MapBuilder.h index c764a1683..4e4875853 100644 --- a/src/tools/mmaps_generator/MapBuilder.h +++ b/src/tools/mmaps_generator/MapBuilder.h @@ -27,13 +27,13 @@ namespace MMAP { struct MapTiles { - MapTiles() : m_mapId(uint32(-1)), m_tiles(nullptr) {} + MapTiles() : m_mapId(uint32(-1)) {} MapTiles(uint32 id, std::set* tiles) : m_mapId(id), m_tiles(tiles) {} ~MapTiles() = default; uint32 m_mapId; - std::set* m_tiles; + std::set* m_tiles{nullptr}; bool operator==(uint32 id) { @@ -45,7 +45,7 @@ namespace MMAP struct Tile { - Tile() : chf(nullptr), solid(nullptr), cset(nullptr), pmesh(nullptr), dmesh(nullptr) {} + Tile() {} ~Tile() { rcFreeCompactHeightfield(chf); @@ -54,11 +54,11 @@ namespace MMAP rcFreePolyMesh(pmesh); rcFreePolyMeshDetail(dmesh); } - rcCompactHeightfield* chf; - rcHeightfield* solid; - rcContourSet* cset; - rcPolyMesh* pmesh; - rcPolyMeshDetail* dmesh; + rcCompactHeightfield* chf{nullptr}; + rcHeightfield* solid{nullptr}; + rcContourSet* cset{nullptr}; + rcPolyMesh* pmesh{nullptr}; + rcPolyMeshDetail* dmesh{nullptr}; }; class MapBuilder @@ -116,7 +116,7 @@ namespace MMAP // percentageDone - method to calculate percentage uint32 percentageDone(uint32 totalTiles, uint32 totalTilesDone); - TerrainBuilder* m_terrainBuilder; + TerrainBuilder* m_terrainBuilder{nullptr}; TileList m_tiles; bool m_debugOutput; @@ -133,7 +133,7 @@ namespace MMAP std::atomic m_totalTilesBuilt; // build performance - not really used for now - rcContext* m_rcContext; + rcContext* m_rcContext{nullptr}; std::vector _workerThreads; ProducerConsumerQueue _queue; diff --git a/src/tools/vmap4_extractor/model.h b/src/tools/vmap4_extractor/model.h index a43320133..acc035265 100644 --- a/src/tools/vmap4_extractor/model.h +++ b/src/tools/vmap4_extractor/model.h @@ -42,12 +42,12 @@ public: class ModelInstance { public: - uint32 id; + uint32 id{0}; Vec3D pos, rot; - uint16 scale, flags; - float sc; + uint16 scale{0}, flags{0}; + float sc{0.0f}; - ModelInstance() : id(0), scale(0), flags(0), sc(0.0f) {} + ModelInstance() {} ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile); };