refactor(Core): apply clang-tidy modernize-* (#9975)

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Francesco Borzì
2022-01-17 14:35:07 +01:00
committed by GitHub
parent fe4899202d
commit 9dc88def35
71 changed files with 533 additions and 534 deletions

View File

@@ -98,9 +98,9 @@ struct ChaseAngle
float RelativeAngle; // we want to be at this angle relative to the target (0 = front, M_PI = back)
float Tolerance; // but we'll tolerate anything within +- this much
float UpperBound() const;
float LowerBound() const;
bool IsAngleOkay(float relativeAngle) const;
[[nodiscard]] float UpperBound() const;
[[nodiscard]] float LowerBound() const;
[[nodiscard]] bool IsAngleOkay(float relativeAngle) const;
};
// assume it is 25 yard per 0.6 second

View File

@@ -84,18 +84,18 @@ class PathGenerator
void SetUseRaycast(bool useRaycast) { _useRaycast = useRaycast; }
// result getters
G3D::Vector3 const& GetStartPosition() const { return _startPosition; }
G3D::Vector3 const& GetEndPosition() const { return _endPosition; }
G3D::Vector3 const& GetActualEndPosition() const { return _actualEndPosition; }
[[nodiscard]] G3D::Vector3 const& GetStartPosition() const { return _startPosition; }
[[nodiscard]] G3D::Vector3 const& GetEndPosition() const { return _endPosition; }
[[nodiscard]] G3D::Vector3 const& GetActualEndPosition() const { return _actualEndPosition; }
Movement::PointsArray const& GetPath() const { return _pathPoints; }
[[nodiscard]] Movement::PointsArray const& GetPath() const { return _pathPoints; }
PathType GetPathType() const { return _type; }
[[nodiscard]] PathType GetPathType() const { return _type; }
// shortens the path until the destination is the specified distance from the target point
void ShortenPathUntilDist(G3D::Vector3 const& point, float dist);
float getPathLength() const
[[nodiscard]] float getPathLength() const
{
float len = 0.0f;
float dx, dy, dz;
@@ -156,19 +156,19 @@ class PathGenerator
void SetActualEndPosition(G3D::Vector3 const& point) { _actualEndPosition = point; }
void NormalizePath();
bool InRange(G3D::Vector3 const& p1, G3D::Vector3 const& p2, float r, float h) const;
float Dist3DSqr(G3D::Vector3 const& p1, G3D::Vector3 const& p2) const;
[[nodiscard]] bool InRange(G3D::Vector3 const& p1, G3D::Vector3 const& p2, float r, float h) const;
[[nodiscard]] float Dist3DSqr(G3D::Vector3 const& p1, G3D::Vector3 const& p2) const;
bool InRangeYZX(float const* v1, float const* v2, float r, float h) const;
dtPolyRef GetPathPolyByPosition(dtPolyRef const* polyPath, uint32 polyPathSize, float const* Point, float* Distance = nullptr) const;
dtPolyRef GetPolyByLocation(float const* Point, float* Distance) const;
bool HaveTile(G3D::Vector3 const& p) const;
[[nodiscard]] bool HaveTile(G3D::Vector3 const& p) const;
void BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 const& endPos);
void BuildPointPath(float const* startPoint, float const* endPoint);
void BuildShortcut();
NavTerrain GetNavTerrain(float x, float y, float z) const;
[[nodiscard]] NavTerrain GetNavTerrain(float x, float y, float z) const;
void CreateFilter();
void UpdateFilter();

View File

@@ -25,9 +25,9 @@ namespace Movement
{
struct Location : public Vector3
{
Location() {}
Location() = default;
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) : Vector3(v) {}
Location(const Vector3& v, float o) : Vector3(v), orientation(o) {}
float orientation{0};

View File

@@ -89,7 +89,7 @@ namespace Movement
void UninitializedSplineInitMethod(Vector3 const*, index_type, bool, index_type) { ABORT(); }
public:
explicit SplineBase() {}
explicit SplineBase() = default;
/** 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]