Fixed clang-tidy warnings

This commit is contained in:
Jan Mrna
2025-10-31 07:22:26 +01:00
parent 69d08e5310
commit 30eecc366e
6 changed files with 11 additions and 9 deletions

View File

@@ -102,7 +102,9 @@ void Map::PaintLine(TilePos start_tile, TilePos stop_tile, double width,
const vec<double, 2> ortho = step.GetOrthogonal(); const vec<double, 2> ortho = step.GetOrthogonal();
LOG_DEBUG("step = ", step, " ortho = ", ortho); LOG_DEBUG("step = ", step, " ortho = ", ortho);
// NOLINTNEXTLINE(clang-analyzer-security.FloatLoopCounter)
for (double t = 0; t < line_length; t += 1.0) { for (double t = 0; t < line_length; t += 1.0) {
// NOLINTNEXTLINE(clang-analyzer-security.FloatLoopCounter)
for (double ortho_t = 0; ortho_t < width; ortho_t += 0.1) { for (double ortho_t = 0; ortho_t < width; ortho_t += 0.1) {
auto tile_pos = start + step * t + ortho * ortho_t; auto tile_pos = start + step * t + ortho * ortho_t;
TilePos tile_pos_int{static_cast<int32_t>(tile_pos.x()), TilePos tile_pos_int{static_cast<int32_t>(tile_pos.x()),

View File

@@ -22,7 +22,7 @@ enum class PathFinderType {
class PathFinderBase { class PathFinderBase {
public: public:
PathFinderBase(const Map *m); PathFinderBase(const Map *m);
~PathFinderBase() = default; virtual ~PathFinderBase() = default;
PathFinderBase(const PathFinderBase &) = delete; PathFinderBase(const PathFinderBase &) = delete;
PathFinderBase(PathFinderBase &&) = delete; PathFinderBase(PathFinderBase &&) = delete;
@@ -36,7 +36,7 @@ protected:
const Map *m_Map; const Map *m_Map;
}; };
class LinearPathFinder : public PathFinderBase { class LinearPathFinder final : public PathFinderBase {
public: public:
LinearPathFinder(const Map *m) : PathFinderBase(m) {} LinearPathFinder(const Map *m) : PathFinderBase(m) {}

View File

@@ -9,7 +9,7 @@
namespace pathfinder { namespace pathfinder {
class BFS : public PathFinderBase { class BFS final : public PathFinderBase {
public: public:
BFS(const Map *m) : PathFinderBase(m) {} BFS(const Map *m) : PathFinderBase(m) {}

View File

@@ -10,7 +10,7 @@
namespace pathfinder { namespace pathfinder {
class Dijkstra : public PathFinderBase { class Dijkstra final : public PathFinderBase {
public: public:
Dijkstra(const Map *m) : PathFinderBase(m) {} Dijkstra(const Map *m) : PathFinderBase(m) {}

View File

@@ -10,7 +10,7 @@
namespace pathfinder { namespace pathfinder {
class GBFS : public PathFinderBase { class GBFS final : public PathFinderBase {
public: public:
GBFS(const Map *m) : PathFinderBase(m) {} GBFS(const Map *m) : PathFinderBase(m) {}

View File

@@ -17,13 +17,13 @@ std::unique_ptr<PathFinderBase> create(PathFinderType type, const Map *map) {
using namespace pathfinder; using namespace pathfinder;
switch (type) { switch (type) {
case PathFinderType::LINEAR: case PathFinderType::LINEAR:
return std::move(std::make_unique<LinearPathFinder>(map)); return std::make_unique<LinearPathFinder>(map);
case PathFinderType::BFS: case PathFinderType::BFS:
return std::move(std::make_unique<BFS>(map)); return std::make_unique<BFS>(map);
case PathFinderType::DIJKSTRA: case PathFinderType::DIJKSTRA:
return std::move(std::make_unique<Dijkstra>(map)); return std::make_unique<Dijkstra>(map);
case PathFinderType::GBFS: case PathFinderType::GBFS:
return std::move(std::make_unique<GBFS>(map)); return std::make_unique<GBFS>(map);
case PathFinderType::COUNT: case PathFinderType::COUNT:
LOG_WARNING("Incorrect pathfinder type"); LOG_WARNING("Incorrect pathfinder type");
return nullptr; return nullptr;