19 #ifndef WB_ACTION_HPP_
20 #define WB_ACTION_HPP_
33 class action :
public boost::enable_shared_from_this<action>
40 virtual std::ostream&
print(std::ostream&
s)
const = 0;
49 virtual void execute(
bool& success,
bool& complete) = 0;
virtual error check_validity() const =0
Check the validity of the action.
virtual fake_unit_ptr get_fake_unit()=0
virtual void redraw()
Redrawing function, called each time the action situation might have changed.
bool valid()
Returns whether this action is valid or not.
size_t team_index() const
Returns the index of the team that owns this action.
virtual void draw_hex(const map_location &hex)=0
Gets called by display when drawing a hex, to allow actions to draw to the screen.
Contains typedefs for the whiteboard.
ctor_err(const std::string &message)
virtual void execute(bool &success, bool &complete)=0
Output parameters: success: Whether or not to continue an execute-all after this execution complete: ...
virtual std::ostream & print(std::ostream &s) const =0
size_t get_unit_id() const
Returns the id of the unit targeted by this action.
virtual unit_ptr get_unit() const =0
Return the unit targeted by this action.
Encapsulates the map of the game.
int side_number() const
Returns the number of the side that owns this action, i.e.
static action_ptr from_config(config const &, bool hidden)
Constructs an object of a subclass of wb::action using a config.
void hide()
Sets whether or not the action should be drawn on the screen.
Base class for all the errors encountered by the engine.
virtual config to_config() const
Constructs and returns a config object representing this object.
Container associating units to locations.
std::ostream & operator<<(std::ostream &s, action_ptr action)
GLsizei GLenum GLuint GLuint GLsizei char * message
action(size_t team_index, bool hidden)
virtual void apply_temp_modifier(unit_map &unit_map)=0
Applies temporarily the result of this action to the specified unit map.
virtual void accept(visitor &v)=0
Abstract base class for all the whiteboard planned actions.
A config object defines a single node in a WML file, with access to child nodes.
virtual void remove_temp_modifier(unit_map &unit_map)=0
Removes the result of this action from the specified unit map.
GLsizei const GLcharARB ** string
Holds a temporary unit that can be drawn on the map without being placed in the unit_map.
virtual map_location get_numbering_hex() const =0
Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses...
bool is_numbering_hex(const map_location &hex) const
Indicates whether this hex is the preferred hex to draw the numbering for this action.
virtual void do_hide()
Called by the non-virtual hide() and show(), respectively.