Move pathfinders to dedicated files

This commit is contained in:
Jan Mrna
2025-09-28 09:39:40 +02:00
parent 7eee6a5c54
commit c42a6b647e
20 changed files with 430 additions and 377 deletions

View File

@@ -0,0 +1,26 @@
#pragma once
#include <string_view>
#include <unordered_map>
#include "base.hpp"
#include "map.hpp"
#include "math.hpp"
namespace pathfinder {
class GBFS: public PathFinderBase {
public:
GBFS(const Map* m): PathFinderBase(m) {}
Path CalculatePath(WorldPos start, WorldPos end) override;
const std::string_view& GetName() const override { return m_Name; }
private:
static float Heuristic(const TilePos& a, const TilePos& b);
const std::string_view m_Name = "Greedy Best First Search";
std::unordered_map<TilePos, TilePos, TilePosHash> m_CameFrom;
};
} // pathfinder namespace