A* implementation

Working except for end of path endless loop (0,0 point appearing in paths for no reason?)

Commit mainly because the HDD is on the verge of dying
This commit is contained in:
Teo-CD 2019-06-09 05:18:28 +02:00
parent 250a680cad
commit d42d176e8d
9 changed files with 181 additions and 29 deletions

View file

@ -25,7 +25,7 @@ public:
void runStep();
private:
const sf::Vector2i size;
const pro_maat::GridPos size;
std::vector<Entity> entities;
@ -37,7 +37,15 @@ private:
std::vector<pro_maat::GridPos> occupiedSquares;
Orientation findPath(pro_maat::GridPos start, pro_maat::GridPos end, int sign);
/// If sign is +1, finds a path between start and goal positions.
/// If sign is -1, finds a path away from the goal position, from the starting position.
/// THIS DOES NOT HANDLE ENTITIES BIGGER THAN ONE SQUARE
///
/// \param start Starting position
/// \param goal Goal position
/// \param sign +1 or -1, defines if we go towards or away from the goal
/// \return Orientation of the next move if successful, Orientation::None otherwise.
Orientation findPath(pro_maat::GridPos start, pro_maat::GridPos goal, int sign);
};