19 #define GETTEXT_DOMAIN "wesnoth-editor" 32 if(!mc.map().is_village(
loc_)) {
36 std::vector<team>& teams = mc.teams();
39 if(teams.at(side_number_).owns_village(
loc_)) {
42 }
catch(
const std::out_of_range&) {
46 auto undo =
static_cast<std::unique_ptr<editor_action>
>(std::make_unique<editor_action_village_delete>(
loc_));
48 for(
const team&
t : teams) {
49 if(
t.owns_village(
loc_)) {
50 undo = std::make_unique<editor_action_village>(
loc_,
t.side() - 1);
54 perform_without_undo(mc);
60 std::vector<team>& teams = mc.
teams();
62 for(
team&
t : teams) {
63 if(
t.owns_village(
loc_)) {
78 std::unique_ptr<editor_action> undo;
80 for(
const team&
t : mc.teams()) {
81 if(
t.owns_village(
loc_)) {
83 undo = std::make_unique<editor_action_village>(
loc_,
t.side() - 1);
93 if(
t.owns_village(
loc_)) {
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.
Sets the ownership of a village to the current side.
void perform_without_undo(map_context &mc) const override
Perform the action without creating an undo action.
This class stores all the data for a single 'side' (in game nomenclature).
Manage the empty-palette in the editor.
Base class for all editor actions.
This class wraps around a map to provide a concise interface for the editor to work with...
#define IMPLEMENT_ACTION(id)
Helper macro to implement common action methods.
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 ...
virtual const std::vector< team > & teams() const override
Const teams accessor.
Clears the ownership of a village.