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

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

View File

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

View File

@@ -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<uint32, StaticMapTree*> InstanceTreeMap;

View File

@@ -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

View File

@@ -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<MeshTriangle> triangles;
std::vector<G3D::Vector3> vertexArray;
class WmoLiquid* liquid;
GroupModel_Raw() : mogpflags(0), GroupWMOID(0), liquidflags(0),
liquid(nullptr) { }
GroupModel_Raw() : liquid(nullptr) { }
~GroupModel_Raw();
bool Read(FILE* f);

View File

@@ -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:

View File

@@ -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();
};

View File

@@ -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<G3D::Vector3> vertices;
std::vector<MeshTriangle> triangles;
BIH meshTree;
WmoLiquid* iLiquid;
WmoLiquid* iLiquid{nullptr};
public:
void getMeshData(std::vector<G3D::Vector3>& vertices, std::vector<MeshTriangle>& 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<GroupModel>& 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<GroupModel> groupModels;
BIH groupTree;
public: