38 return sup_d->print(
s);
44 return sup_d->print(
s);
49 s <<
"Suppose-dead for unit " <<
get_unit()->name() <<
" [" <<
get_unit()->id() <<
"] "
50 <<
"at (" <<
loc_ <<
")";
55 :
action(team_index,hidden)
56 , unit_underlying_id_(curr_unit.underlying_id())
57 , unit_id_(curr_unit.
id())
65 , unit_underlying_id_(0)
67 ,
loc_(cfg.mandatory_child(
"loc_")[
"x"],cfg.mandatory_child(
"loc_")[
"y"],
wml_loc())
107 {success =
false; complete =
true;}
113 DBG_WB <<
"Suppose dead: Temporarily removing unit " << removed_unit->name() <<
" [" << removed_unit->id()
114 <<
"] from (" <<
loc_ <<
")";
173 final_cfg[
"type"]=
"suppose_dead";
180 final_cfg.
add_child(
"loc_", std::move(loc_cfg));
A config object defines a single node in a WML file, with access to child nodes.
config & add_child(config_key_type key)
bool invalidate(const map_location &loc)
Function to invalidate a specific tile for redrawing.
void drawing_buffer_add(const drawing_layer layer, const map_location &loc, decltype(draw_helper::do_draw) draw_func)
Add an item to the drawing buffer.
static display * get_singleton()
Returns the display object if a display object exists.
virtual const unit_map & units() const override
Generic locator abstracting the location of an image.
Container associating units to locations.
unit_ptr extract(const map_location &loc)
Extracts a unit from the map.
unit_iterator find(std::size_t id)
umap_retval_pair_t insert(unit_ptr p)
Inserts the unit pointed to by p into the map.
This class represents a single unit of a specific type.
Abstract base class for all the whiteboard planned actions.
bool valid()
Returns whether this action is valid or not.
virtual config to_config() const
Constructs and returns a config object representing this object.
virtual void accept(visitor &v)
std::size_t unit_underlying_id_
virtual unit_ptr get_unit() const
Return the unit targeted by this action.
virtual void execute(bool &success, bool &complete)
Output parameters: success: Whether or not to continue an execute-all after this execution complete: ...
virtual error check_validity() const
Check the validity of the action.
virtual std::ostream & print(std::ostream &s) const
virtual void apply_temp_modifier(unit_map &unit_map)
Applies temporarily the result of this action to the specified unit map.
suppose_dead(std::size_t team_index, bool hidden, unit &curr_unit, const map_location &loc)
virtual void remove_temp_modifier(unit_map &unit_map)
Removes the result of this action from the specified unit map.
std::shared_ptr< suppose_dead > shared_from_this()
virtual void redraw()
Redrawing function, called each time the action situation might have changed.
virtual void draw_hex(const map_location &hex)
Gets called by display when drawing a hex, to allow actions to draw to the screen.
virtual map_location get_source_hex() const
Return the location at which this action was planned.
virtual config to_config() const
Constructs and returns a config object representing this object.
Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses.
virtual void visit(move_ptr move)=0
Definitions for the interface to Wesnoth Markup Language (WML).
map_display and display: classes which take care of displaying the map and game-data on the screen.
Drawing functions, for drawing things on the screen.
@ arrows
Arrows from the arrows framework.
std::string id
Text to match against addon_info.tags()
void blit(const texture &tex, const SDL_Rect &dst)
Draws a texture, or part of a texture, at the given location.
@ HEXED
Standard hexagonal tile mask applied, removing portions that don't fit.
texture get_texture(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image texture suitable for hardware-accelerated rendering.
std::shared_ptr< suppose_dead > suppose_dead_ptr
std::ostream & operator<<(std::ostream &s, action_ptr action)
std::shared_ptr< suppose_dead const > suppose_dead_const_ptr
std::shared_ptr< const unit > unit_const_ptr
std::shared_ptr< unit > unit_ptr
Encapsulates the map of the game.
An abstract description of a rectangle with integer coordinates.
pointer get_shared_ptr() const
This is exactly the same as operator-> but it's slightly more readable, and can replace &*iter syntax...
static map_location::direction s
visitor is an abstract interface : action.accept(visitor) calls visitor.visit(action)