refactor(Core): apply clang-tidy modernize-use-nodiscard (#3835)

This commit is contained in:
Francesco Borzì
2020-12-06 19:39:48 +01:00
committed by GitHub
parent d4a58700d4
commit 161302252e
82 changed files with 1565 additions and 1569 deletions
@@ -100,7 +100,7 @@ public:
delete[] dat.primBound;
delete[] dat.indices;
}
uint32 primCount() const { return objects.size(); }
[[nodiscard]] uint32 primCount() const { return objects.size(); }
template<typename RayCallback>
void intersectRay(const G3D::Ray& r, RayCallback& intersectCallback, float& maxDist, bool stopAtFirstHit) const
+4 -4
View File
@@ -27,7 +27,7 @@ public:
DynamicMapTree();
~DynamicMapTree();
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2,
[[nodiscard]] bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2,
float z2, uint32 phasemask) const;
bool getIntersectionTime(uint32 phasemask, const G3D::Ray& ray,
@@ -37,12 +37,12 @@ public:
const G3D::Vector3& pPos2, G3D::Vector3& pResultHitPos,
float pModifyDist) const;
float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const;
[[nodiscard]] float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const;
void insert(const GameObjectModel&);
void remove(const GameObjectModel&);
bool contains(const GameObjectModel&) const;
int size() const;
[[nodiscard]] bool contains(const GameObjectModel&) const;
[[nodiscard]] int size() const;
void balance();
void update(uint32 diff);
@@ -71,11 +71,11 @@ namespace VMAP
*/
void setEnableHeightCalc(bool pVal) { iEnableHeightCalc = pVal; }
bool isLineOfSightCalcEnabled() const { return (iEnableLineOfSightCalc); }
bool isHeightCalcEnabled() const { return (iEnableHeightCalc); }
bool isMapLoadingEnabled() const { return (iEnableLineOfSightCalc || iEnableHeightCalc ); }
[[nodiscard]] bool isLineOfSightCalcEnabled() const { return (iEnableLineOfSightCalc); }
[[nodiscard]] bool isHeightCalcEnabled() const { return (iEnableHeightCalc); }
[[nodiscard]] bool isMapLoadingEnabled() const { return (iEnableLineOfSightCalc || iEnableHeightCalc ); }
virtual std::string getDirFileName(unsigned int pMapId, int x, int y) const = 0;
[[nodiscard]] virtual std::string getDirFileName(unsigned int pMapId, int x, int y) const = 0;
/**
Query world model area info.
\param z gets adjusted to the ground height for which this are info is valid
@@ -81,7 +81,7 @@ namespace VMAP
public:
// public for debug
G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
[[nodiscard]] G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
static std::string getMapFileName(unsigned int mapId);
VMapManager2();
@@ -108,7 +108,7 @@ namespace VMAP
void releaseModelInstance(const std::string& filename);
// what's the use of this? o.O
std::string getDirFileName(unsigned int mapId, int /*x*/, int /*y*/) const override
[[nodiscard]] std::string getDirFileName(unsigned int mapId, int /*x*/, int /*y*/) const override
{
return getMapFileName(mapId);
}
+4 -4
View File
@@ -56,9 +56,9 @@ namespace VMAP
StaticMapTree(uint32 mapID, const std::string& basePath);
~StaticMapTree();
bool isInLineOfSight(const G3D::Vector3& pos1, const G3D::Vector3& pos2) const;
[[nodiscard]] bool isInLineOfSight(const G3D::Vector3& pos1, const G3D::Vector3& pos2) const;
bool getObjectHitPos(const G3D::Vector3& pos1, const G3D::Vector3& pos2, G3D::Vector3& pResultHitPos, float pModifyDist) const;
float getHeight(const G3D::Vector3& pPos, float maxSearchDist) const;
[[nodiscard]] float getHeight(const G3D::Vector3& pPos, float maxSearchDist) const;
bool getAreaInfo(G3D::Vector3& pos, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const;
bool GetLocationInfo(const G3D::Vector3& pos, LocationInfo& info) const;
@@ -66,8 +66,8 @@ namespace VMAP
void UnloadMap(VMapManager2* vm);
bool LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
bool isTiled() const { return iIsTiled; }
uint32 numLoadedTiles() const { return iLoadedTiles.size(); }
[[nodiscard]] bool isTiled() const { return iIsTiled; }
[[nodiscard]] uint32 numLoadedTiles() const { return iLoadedTiles.size(); }
void getModelInstances(ModelInstance*& models, uint32& count);
};
+1 -1
View File
@@ -36,7 +36,7 @@ namespace VMAP
{
iRotation = G3D::Matrix3::fromEulerAnglesZYX(G3D::pif() * iDir.y / 180.f, G3D::pif() * iDir.x / 180.f, G3D::pif() * iDir.z / 180.f);
}
G3D::Vector3 transform(const G3D::Vector3& pIn) const;
[[nodiscard]] G3D::Vector3 transform(const G3D::Vector3& pIn) const;
void moveToBasePos(const G3D::Vector3& pBasePos) { iPos -= pBasePos; }
};
@@ -40,17 +40,17 @@ class GameObjectModel /*, public Intersectable*/
public:
std::string name;
const G3D::AABox& getBounds() const { return iBound; }
[[nodiscard]] const G3D::AABox& getBounds() const { return iBound; }
~GameObjectModel();
const G3D::Vector3& getPosition() const { return iPos;}
[[nodiscard]] const G3D::Vector3& getPosition() const { return iPos;}
/** Enables\disables collision. */
void disable() { phasemask = 0;}
void enable(uint32 ph_mask) { phasemask = ph_mask;}
bool isEnabled() const {return phasemask != 0;}
[[nodiscard]] bool isEnabled() const {return phasemask != 0;}
bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const;
+1 -1
View File
@@ -42,7 +42,7 @@ namespace VMAP
bool operator==(const ModelSpawn& other) const { return ID == other.ID; }
//uint32 hashCode() const { return ID; }
// temp?
const G3D::AABox& getBounds() const { return iBound; }
[[nodiscard]] const G3D::AABox& getBounds() const { return iBound; }
static bool readFromFile(FILE* rf, ModelSpawn& spawn);
static bool writeToFile(FILE* rw, const ModelSpawn& spawn);
+5 -5
View File
@@ -40,7 +40,7 @@ namespace VMAP
~WmoLiquid();
WmoLiquid& operator=(const WmoLiquid& other);
bool GetLiquidHeight(const G3D::Vector3& pos, float& liqHeight) const;
uint32 GetType() const { return iType; }
[[nodiscard]] uint32 GetType() const { return iType; }
float* GetHeightStorage() { return iHeight; }
uint8* GetFlagsStorage() { return iFlags; }
uint32 GetFileSize();
@@ -74,12 +74,12 @@ namespace VMAP
bool IntersectRay(const G3D::Ray& ray, float& distance, bool stopAtFirstHit) const;
bool IsInsideObject(const G3D::Vector3& pos, const G3D::Vector3& down, float& z_dist) const;
bool GetLiquidLevel(const G3D::Vector3& pos, float& liqHeight) const;
uint32 GetLiquidType() const;
[[nodiscard]] uint32 GetLiquidType() const;
bool writeToFile(FILE* wf);
bool readFromFile(FILE* rf);
const G3D::AABox& GetBound() const { return iBound; }
uint32 GetMogpFlags() const { return iMogpFlags; }
uint32 GetWmoID() const { return iGroupWMOID; }
[[nodiscard]] const G3D::AABox& GetBound() const { return iBound; }
[[nodiscard]] uint32 GetMogpFlags() const { return iMogpFlags; }
[[nodiscard]] uint32 GetWmoID() const { return iGroupWMOID; }
protected:
G3D::AABox iBound;
uint32 iMogpFlags;// 0x8 outdor; 0x2000 indoor