27 #define ERR_NG LOG_STREAM(err, log_engine)
28 #define LOG_NG LOG_STREAM(info, log_engine)
33 const std::vector<map_location>::const_iterator & begin,
34 const std::vector<map_location>::const_iterator & end,
39 , starting_dir(dir ==
map_location::direction::indeterminate ?
moved->facing() : dir)
40 , goto_hex(
moved->get_goto())
69 std::vector<map_location> rev_route =
route;
75 if(u == units.
end() || u_end != units.
end()) {
77 ERR_NG <<
"Illegal 'undo' found. Possible abuse of [allow_undo]?";
87 u->anim_comp().reset_affect_adjacent(
gui);
88 units.
move(u->get_location(), rev_route.back());
90 u->anim_comp().reset_affect_adjacent(
gui);
93 u = units.
find(rev_route.back());
95 u->set_movement(saved_moves,
true);
96 u->anim_comp().set_standing();
98 gui.invalidate_unit_after_move(rev_route.front(), rev_route.back());
A config object defines a single node in a WML file, with access to child nodes.
config & mandatory_child(config_key_type key, int n=0)
Returns the nth child with the given key, or throws an error if there is none.
virtual const unit_map & units() const override
static game_display * get_singleton()
Container associating units to locations.
unit_iterator find(std::size_t id)
umap_retval_pair_t move(const map_location &src, const map_location &dst)
Moves a unit from location src to location dst.
static void clear_status_caches()
Clear this unit status cache for all units.
Standard logging facilities (interface).
static auto reg_undo_move
void move_unit(const std::vector< map_location > &path, const unit_ptr &u, bool animate, map_location::direction dir, bool force_scroll)
Display a unit moving along a given path.
@ moved
All moves and possible attacks have been done.
std::shared_ptr< const unit > unit_const_ptr
base class for classes that clear srhoud (move/recruit/recall)
route_t route
The hexes occupied by the affected unit during this action.
void write(config &cfg) const
map_location::direction starting_dir
virtual bool undo(int side)
Undoes this action.
move_action(const unit_const_ptr &moved, const std::vector< map_location >::const_iterator &begin, const std::vector< map_location >::const_iterator &end, int sm, const map_location::direction dir)
virtual void write(config &cfg) const
Writes this into the provided config.
Records information to be able to undo an action.
virtual void write(config &cfg) const
Writes this into the provided config.
Encapsulates the map of the game.
static std::string write_direction(direction dir)
direction
Valid directions which can be moved in our hexagonal world.
pointer get_shared_ptr() const
This is exactly the same as operator-> but it's slightly more readable, and can replace &*iter syntax...
Display units performing various actions: moving, attacking, and dying.
static lg::log_domain log_engine("engine")