From 30eecc366eba1b0a68764f564ca19a771f82e902 Mon Sep 17 00:00:00 2001 From: Jan Mrna Date: Fri, 31 Oct 2025 07:22:26 +0100 Subject: [PATCH] Fixed clang-tidy warnings --- cpp/src/map.cpp | 2 ++ cpp/src/pathfinder/base.hpp | 4 ++-- cpp/src/pathfinder/bfs.hpp | 2 +- cpp/src/pathfinder/dijkstra.hpp | 2 +- cpp/src/pathfinder/gbfs.hpp | 2 +- cpp/src/pathfinder/utils.cpp | 8 ++++---- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/cpp/src/map.cpp b/cpp/src/map.cpp index 5f378cf..94b375a 100644 --- a/cpp/src/map.cpp +++ b/cpp/src/map.cpp @@ -102,7 +102,9 @@ void Map::PaintLine(TilePos start_tile, TilePos stop_tile, double width, const vec ortho = step.GetOrthogonal(); LOG_DEBUG("step = ", step, " ortho = ", ortho); + // NOLINTNEXTLINE(clang-analyzer-security.FloatLoopCounter) 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) { auto tile_pos = start + step * t + ortho * ortho_t; TilePos tile_pos_int{static_cast(tile_pos.x()), diff --git a/cpp/src/pathfinder/base.hpp b/cpp/src/pathfinder/base.hpp index c9cb09c..da7d994 100644 --- a/cpp/src/pathfinder/base.hpp +++ b/cpp/src/pathfinder/base.hpp @@ -22,7 +22,7 @@ enum class PathFinderType { class PathFinderBase { public: PathFinderBase(const Map *m); - ~PathFinderBase() = default; + virtual ~PathFinderBase() = default; PathFinderBase(const PathFinderBase &) = delete; PathFinderBase(PathFinderBase &&) = delete; @@ -36,7 +36,7 @@ protected: const Map *m_Map; }; -class LinearPathFinder : public PathFinderBase { +class LinearPathFinder final : public PathFinderBase { public: LinearPathFinder(const Map *m) : PathFinderBase(m) {} diff --git a/cpp/src/pathfinder/bfs.hpp b/cpp/src/pathfinder/bfs.hpp index 2d19b02..b8ad6b4 100644 --- a/cpp/src/pathfinder/bfs.hpp +++ b/cpp/src/pathfinder/bfs.hpp @@ -9,7 +9,7 @@ namespace pathfinder { -class BFS : public PathFinderBase { +class BFS final : public PathFinderBase { public: BFS(const Map *m) : PathFinderBase(m) {} diff --git a/cpp/src/pathfinder/dijkstra.hpp b/cpp/src/pathfinder/dijkstra.hpp index beeae81..9152f2e 100644 --- a/cpp/src/pathfinder/dijkstra.hpp +++ b/cpp/src/pathfinder/dijkstra.hpp @@ -10,7 +10,7 @@ namespace pathfinder { -class Dijkstra : public PathFinderBase { +class Dijkstra final : public PathFinderBase { public: Dijkstra(const Map *m) : PathFinderBase(m) {} diff --git a/cpp/src/pathfinder/gbfs.hpp b/cpp/src/pathfinder/gbfs.hpp index 29a7266..e9ca849 100644 --- a/cpp/src/pathfinder/gbfs.hpp +++ b/cpp/src/pathfinder/gbfs.hpp @@ -10,7 +10,7 @@ namespace pathfinder { -class GBFS : public PathFinderBase { +class GBFS final : public PathFinderBase { public: GBFS(const Map *m) : PathFinderBase(m) {} diff --git a/cpp/src/pathfinder/utils.cpp b/cpp/src/pathfinder/utils.cpp index f4a0717..3de5272 100644 --- a/cpp/src/pathfinder/utils.cpp +++ b/cpp/src/pathfinder/utils.cpp @@ -17,13 +17,13 @@ std::unique_ptr create(PathFinderType type, const Map *map) { using namespace pathfinder; switch (type) { case PathFinderType::LINEAR: - return std::move(std::make_unique(map)); + return std::make_unique(map); case PathFinderType::BFS: - return std::move(std::make_unique(map)); + return std::make_unique(map); case PathFinderType::DIJKSTRA: - return std::move(std::make_unique(map)); + return std::make_unique(map); case PathFinderType::GBFS: - return std::move(std::make_unique(map)); + return std::make_unique(map); case PathFinderType::COUNT: LOG_WARNING("Incorrect pathfinder type"); return nullptr;