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

@ -13,17 +13,21 @@
/// Decorates entities with rules which will modify its behaviour
template <State targetState, EntityType targetType>
class Rule : public Entity
class Rule : private Entity
{
public:
Rule(Entity& entity, const std::vector<Entity>& entities,
const std::vector<pro_maat::GridPos>& occupiedSquares, const pro_maat::GridPos& mapSize);
/// Update according to the targetState and targetType
void update() override;
// Simply delegate the following function calls to the original entity
void move(Orientation orientation) override;
State getState() const override;
const sf::RectangleShape& getShape() const override;
pro_maat::GridPos getTarget() const override;
const pro_maat::GridPos getPosition() const override;
const std::vector<pro_maat::GridPos> getOccupiedSquares() const override;
@ -188,6 +192,12 @@ const sf::RectangleShape& Rule<targetState, targetType>::getShape() const
return entity.getShape();
}
template<State targetState, EntityType targetType>
pro_maat::GridPos Rule<targetState, targetType>::getTarget() const
{
return entity.getTarget();
}
template<State targetState, EntityType targetType>
const pro_maat::GridPos Rule<targetState, targetType>::getPosition() const
{