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

@ -34,6 +34,7 @@ enum class Orientation
East = 90,
South = 180,
West = 270,
None,
};
@ -47,13 +48,15 @@ public:
void move(Orientation orientation);
void update();
const sf::RectangleShape& getShape() const;
const State getState() const;
const sf::RectangleShape& getShape() const;
/// Returns the grid coordinates at the center of the entity
const pro_maat::GridPos getPosition() const;
// Don't like it : iterates over every square every tick
const std::vector<pro_maat::GridPos> getOccupiedSquares() const;
/// Position of the target of the current action on the map
pro_maat::GridPos target;
private:
@ -62,6 +65,7 @@ private:
EntityType type;
// As it contains position, size and orientation, we do not need anything more
// TODO : Maybe we need something more : lots of computations
sf::RectangleShape shape;
State currentState;