#pragma once #include #include "App.h" #include #include "node.h" class Pather { public: // Constructor Pather(Map* map_); ~Pather(); // Reference to the map data Map* map; // Containers for the loop, probably inefficient as hell std::unordered_map open_list; std::unordered_map closed_list; // A stack allocated 2d array from a template I stole from stackOverflow MultiArray visited_map; // Return a deque with the movement info to path to the end position from the start position std::deque getPathTo(sf::Vector2i start, sf::Vector2i end); // Returns the end node of the current path sf::Vector2i getEndNodePosition(); // Returns the current active node node* getActiveNode(); private: // Whether we couldn't find a path bool no_path = false; // If we found the path and can exit early bool early_exit; // Calculate the return path from back tracing the active nodes std::deque returnPath(); // The main iterative loop for a* std::deque loop(); // Movement list for the Explorer std::deque path_list; // Start positions node node* start_node; // Current positions node node* active_node; // End positions node node* end_node; };