22 #define GETTEXT_DOMAIN "wesnoth-editor" 37 auto undo = std::make_unique<editor_action_unit_delete>(
loc_);
38 perform_without_undo(mc);
56 if(unit_it != units.
end()) {
57 auto undo = std::make_unique<editor_action_unit>(
loc_, *unit_it);
79 auto undo = std::make_unique<editor_action_unit_replace>(new_loc_,
loc_);
113 auto undo = std::make_unique<editor_action_unit_facing>(
loc_, old_direction_, new_direction_);
123 if(unit_it != units.
end()) {
124 unit_it->set_facing(new_direction_);
125 unit_it->anim_comp().set_standing();
void add_changed_location(const map_location &loc)
void perform_without_undo(map_context &mc) const override
Perform the action without creating an undo action.
This class represents a single unit of a specific type.
void perform_without_undo(map_context &mc) const override
Perform the action without creating an undo action.
std::unique_ptr< editor_action > perform(map_context &mc) const override
Perform the action, returning an undo action that, when performed, shall reverse any effects of this ...
std::size_t erase(const map_location &l)
Erases the unit at location l, if any.
void perform_without_undo(map_context &mc) const override
Perform the action without creating an undo action.
static void clear_status_caches()
Clear this unit status cache for all units.
umap_retval_pair_t add(const map_location &l, const unit &u)
Adds a copy of unit u at location l of the map.
umap_retval_pair_t move(const map_location &src, const map_location &dst)
Moves a unit from location src to location dst.
Manage the empty-palette in the editor.
unit_iterator find(std::size_t id)
unit_animation_component & anim_comp() const
place a new unit on the map
Base class for all editor actions.
This class wraps around a map to provide a concise interface for the editor to work with...
virtual const unit_map & units() const override
Const units accessor.
Remove a unit from the map.
#define IMPLEMENT_ACTION(id)
Helper macro to implement common action methods.
Container associating units to locations.
void set_standing(bool with_bars=true)
Sets the animation state to standing.
void perform_without_undo(map_context &mc) const override
Perform the action without creating an undo action.