16 #define GETTEXT_DOMAIN "wesnoth-editor"
57 std::set<map_location> result;
59 result.insert(
i.offset.vector_sum(
loc));
74 ti.offset.vector_sum_assign(offset);
85 sum.
x /=
static_cast<int>(
items_.size());
86 sum.
y /=
static_cast<int>(
items_.size());
96 area_.insert(ti.offset);
116 throw editor_exception(
"Map fragment rotation resulted in duplicate entries");
136 throw editor_exception(
"Map fragment rotation resulted in duplicate entries");
143 ti.offset.x = -ti.offset.x;
151 ti.offset.y = -ti.offset.y;
152 if (ti.offset.x % 2) {
167 std::stringstream ss;
170 ss <<
"(" << ti.offset <<
")";
174 ss <<
"(" <<
loc <<
")";
void flip_vertical()
Flip the map fragment vertically.
std::set< map_location > get_offset_area(const map_location &offset) const
Get the area covered by this map fragment, shifted by an offset.
std::set< map_location > get_area() const
Get the area covered by this map fragment.
map_location center_of_mass() const
Get the center of the map fragment, mass-wise.
std::string dump() const
Debug dump to a string.
std::vector< tile_info > items_
The data of this map_fragment.
void flip_horizontal()
Flip the map fragment horizontally.
void paste_into(gamemap &map, const map_location &loc) const
Paste the map fragment into the map, treating loc as the (0,0) point (offset).
void shift(const map_location &offset)
Shift all tiles in the map fragment by the specified offset.
std::set< map_location > area_
void rotate_60_ccw()
Rotate the map fragment 60 degrees counter-clockwise around (0,0)
void center_by_mass()
Shift the map fragment so it is roughly centered around the (0,0) point, mass-wise.
map_fragment()
Create an empty map fragment.
void add_tile(const gamemap &map, const map_location &loc)
Add a single location and pull its info from the map.
void add_tiles(const gamemap &map, const std::set< map_location > &loc)
Add many locations and pull their info from the map.
void rotate_60_cw()
Rotate the map fragment 60 degrees clockwise around (0,0)
Encapsulates the map of the game.
void set_terrain(const map_location &loc, const terrain_code &terrain, const terrain_type_data::merge_mode mode=terrain_type_data::BOTH, bool replace_if_failed=false) override
Clobbers over the terrain at location 'loc', with the given terrain.
constexpr bool is_odd(T num)
Manage the empty-palette in the editor.
std::size_t size(std::string_view str)
Length in characters of a UTF-8 string.
This represents a tile along with information about it, namely the terrain, possibly other informatio...
Encapsulates the map of the game.
map_location & vector_sum_assign(const map_location &a)
map_location get_direction(direction dir, unsigned int n=1u) const
static const map_location & ZERO()