Grail (C++)  1.3.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Action.hh
1 // Copyright QED Software 2023.
2 
3 #ifndef GRAIL_ACTION_H
4 #define GRAIL_ACTION_H
5 
6 #include "ActionTemplate.hh"
7 
8 namespace grail
9 {
10 namespace planner
11 {
12  class Action
13  {
14  public:
15  Action(const ActionTemplate& actionTemplate, std::vector<unsigned int>&& argumentIndices);
16  Action(Action&& other) = default;
17  ~Action() = default;
18 
19  bool IsLegal(const WorldState& worldState) const;
20  double GetCost(const WorldState& worldState) const;
21  const std::vector<unsigned int>& GetArgumentIndices() const;
22  void ApplyToState(WorldState& worldState) const;
23  const std::string& GetName() const;
24  int GetType() const;
25  Action& operator=(Action&& other) = default;
26 
27  private:
28  const ActionTemplate* actionTemplate;
29  std::vector<unsigned int> argumentIndices{};
30  static thread_local std::vector<WorldObject*> effectFunctionArguments;
31  static thread_local std::vector<const WorldObject*> preconditionFunctionArguments;
32  };
33 }
34 }
35 
36 #endif //GRAIL_ACTION_H
grail::planner::Action
Definition: Action.hh:12
grail::planner::WorldState
A class representing planner world state.
Definition: WorldState.hh:16
grail::planner::ActionTemplate
A class representing an action that can be simulated by grail planner.
Definition: ActionTemplate.hh:22