20 #define GETTEXT_DOMAIN "wesnoth-editor" 33 if(!mc.map().is_village(
loc_)) {
37 std::vector<team>& teams = mc.teams();
40 if(teams.at(side_number_).owns_village(
loc_)) {
43 }
catch(
const std::out_of_range&) {
47 auto undo =
static_cast<std::unique_ptr<editor_action>
>(std::make_unique<editor_action_village_delete>(
loc_));
49 for(
const team&
t : teams) {
50 if(
t.owns_village(
loc_)) {
51 undo = std::make_unique<editor_action_village>(
loc_,
t.side() - 1);
55 perform_without_undo(mc);
61 std::vector<team>& teams = mc.
teams();
63 for(
team&
t : teams) {
64 if(
t.owns_village(
loc_)) {
79 std::unique_ptr<editor_action> undo;
81 for(
const team&
t : mc.teams()) {
82 if(
t.owns_village(
loc_)) {
84 undo = std::make_unique<editor_action_village>(
loc_,
t.side() - 1);
94 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.