14 #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);
84 if (items_.size() > 0) {
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 <<
")";
static const map_location & ZERO()
Old implementation:
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).
GLint GLint GLint GLint GLint GLint y
std::string dump() const
Debug dump to a string.
void rotate_60_ccw()
Rotate the map fragment 60 degrees counter-clockwise around (0,0)
std::set< map_location > get_offset_area(const map_location &offset) const
Get the area covered by this map fragment, shifted by an offset.
Encapsulates the map of the game.
Manage the empty-palette in the editor.
Templates and utility-routines for strings and numbers.
Encapsulates the map of the game.
void flip_vertical()
Flip the map fragment vertically.
void shift(const map_location &offset)
Shift all tiles in the map fragment by the specified offset.
map_location center_of_mass() const
Get the center of the map fragment, mass-wise.
GLint GLint GLint GLint GLint x
This represents a tile along with information about it, namely the terrain, possibly other informatio...
void set_terrain(const map_location &loc, const t_translation::t_terrain &terrain, const terrain_type_data::tmerge_mode mode=terrain_type_data::BOTH, bool replace_if_failed=false)
Clobbers over the terrain at location 'loc', with the given terrain.
void add_tiles(const gamemap &map, const std::set< map_location > &loc)
Add many locations and pull their info from the map.
map_fragment()
Create an empty map fragment.
map_location & vector_sum_assign(const map_location &a)
map_location get_direction(DIRECTION d, unsigned int n=1u) const
std::set< map_location > area_
std::set< map_location > get_area() const
Get the area covered by this map fragment.
std::vector< tile_info > items_
The data of this map_fragment.
void center_by_mass()
Shift the map fragment so it is roughly centered around the (0,0) point, mass-wise.
GLsizei const GLcharARB ** string
void add_tile(const gamemap &map, const map_location &loc)
Add a single location and pull its info from the map.
void rotate_60_cw()
Rotate the map fragment 60 degrees clockwise around (0,0)