#pragma once #include #include #include "math.hpp" #include "map.hpp" namespace pathfinder { using Path = std::vector; enum class PathFinderType { LINEAR = 1, BFS, COUNT, }; class PathFinderBase { public: PathFinderBase() = default; ~PathFinderBase() = default; PathFinderBase(const PathFinderBase&) = delete; PathFinderBase(PathFinderBase&&) = delete; PathFinderBase& operator=(const PathFinderBase&) = delete; PathFinderBase& operator=(PathFinderBase&&) = delete; void SetMap(std::shared_ptr map); virtual const std::string_view& GetName() const = 0; virtual Path CalculatePath(WorldPos target) = 0; private: std::shared_ptr m_Map; }; class LinearPathFinder : public PathFinderBase { public: Path CalculatePath(WorldPos target) override; const std::string_view& GetName() const override { return m_Name; } private: const std::string_view m_Name = "Linear Path"; }; class BFS: public PathFinderBase { public: Path CalculatePath(WorldPos target) override; const std::string_view& GetName() const override { return m_Name; } private: const std::string_view m_Name = "Breadth First Search"; }; std::unique_ptr create(PathFinderType type); } // pathfinder namespace