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())
66 for(
unsigned i = 0;
i < adjacent.size(); ++
i) {
68 if (it == units.
end() || it->incapacitated())
72 it->anim_comp().set_standing();
88 std::vector<map_location> rev_route =
route;
89 std::reverse(rev_route.begin(), rev_route.end());
94 if ( u == units.
end() || u_end != units.
end() ) {
96 ERR_NG <<
"Illegal 'undo' found. Possible abuse of [allow_undo]?";
107 bool halo_adjacent =
false;
108 for(
const auto [
_, cfg] : u->abilities().all_children_view()){
109 if(!cfg[
"halo_image"].empty() && cfg.has_child(
"affect_adjacent")){
110 halo_adjacent =
true;
115 units.
move(u->get_location(), rev_route.back());
120 u = units.
find(rev_route.back());
122 u->set_movement(saved_moves,
true);
123 u->anim_comp().set_standing();
125 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.
static std::string _(const char *str)
void get_adjacent_tiles(const map_location &a, map_location *res)
Function which, given a location, will place all adjacent locations in res.
Standard logging facilities (interface).
static void reset_adjacent(bool &halo_adjacent, unit_map &units, const map_location &loc)
Reset halo of adjacent units when undo move.
void move_unit(const std::vector< map_location > &path, 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 return_village()
Change village owner on undo.
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, int timebonus, int orig, const map_location::direction dir)
virtual void write(config &cfg) const
Writes this into the provided config.
actions that are undoable (this does not include update_shroud and auto_shroud)
virtual void write(config &cfg) const
Writes this into the provided config.
void execute_undo_umc_wml()
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")