Fixed pathfinding for usage with Rule::findTarget()

Fixed Entity::target being public
This commit is contained in:
trotFunky 2019-06-10 01:58:14 +02:00
parent 08e922b0d4
commit 4ab83f1124
4 changed files with 23 additions and 16 deletions

View file

@ -51,6 +51,7 @@ public:
virtual void update();
virtual State getState() const;
virtual pro_maat::GridPos getTarget() const;
virtual const sf::RectangleShape& getShape() const;
/// Returns the grid coordinates at the center of the entity
@ -59,15 +60,12 @@ public:
// Don't like it : iterates over every square every tick
virtual const std::vector<pro_maat::GridPos> getOccupiedSquares() const;
// FIXME : Replace with getter
/// Position of the target of the current action on the map
pro_maat::GridPos target;
protected:
/// Empty constructor for derived class instanciation
Entity();
private:
static const std::map<std::string,EntityType> entityTypeLookup;
@ -81,6 +79,8 @@ private:
/// Used with rules : last to update has priority
State nextState;
/// Target position on the map of the current action
pro_maat::GridPos target;
/// Used with rules : last to update has priority
pro_maat::GridPos nextTarget;