#include <map_manip.hpp>
Public Member Functions | |
editormap (const config &terrain_cfg, const std::string &data) | |
~editormap () | |
std::string | resize (const size_t width, const size_t height, const int x_offset, const int y_offset, const bool do_expand, t_translation::t_terrain filler) |
Resizes the map. | |
std::string | flip (const map_editor::FLIP_AXIS axis) |
Flips the map over an axis. | |
void | set_starting_position (const int pos, const location loc) |
Sets the starting position of a player. | |
Private Member Functions | |
void | swap_starting_position (const size_t x1, const size_t y1, const size_t x2, const size_t y2) |
Exchanges starting positions, If there's a starting location on x1, y1 it will be moved to x2, y2. | |
void | add_tiles_right (const unsigned count, const t_translation::t_terrain &filler) |
Adds column(s) at the right side. | |
void | add_tiles_left (const unsigned count, const t_translation::t_terrain &filler) |
Adds column(s) at the left side. | |
void | remove_tiles_right (const unsigned count) |
Removes column(s) at the right side. | |
void | remove_tiles_left (const unsigned count) |
Removes column(s) at the left side. | |
void | add_tiles_top (const unsigned count, const t_translation::t_terrain &filler) |
Adds row(s) at the top side. | |
void | add_tiles_bottom (const unsigned count, const t_translation::t_terrain &filler) |
Adds row(s) at the bottom side. | |
void | remove_tiles_top (const unsigned count) |
Removes row(s) at the top side. | |
void | remove_tiles_bottom (const unsigned count) |
Removes row(s) at the bottom side. |
Definition at line 38 of file map_manip.hpp.
editormap::editormap | ( | const config & | terrain_cfg, | |
const std::string & | data | |||
) | [inline] |
Definition at line 41 of file map_manip.hpp.
editormap::~editormap | ( | ) | [inline] |
Definition at line 44 of file map_manip.hpp.
std::string editormap::resize | ( | const size_t | width, | |
const size_t | height, | |||
const int | x_offset, | |||
const int | y_offset, | |||
const bool | do_expand, | |||
t_translation::t_terrain | filler | |||
) |
Resizes the map.
width | the new width | |
height | the new height | |
x_offset | the offset in x direction (the x coordinate specified will be the new 0 location) | |
y_offset | the offset in y direction (the y coordinate specified will be the new 0 location) | |
do_expand | try to expand the map depending on the current tiles | |
filler | if the map is enlarged the new tiles are set to this terrain, unless expand is set |
Definition at line 35 of file map_manip.cpp.
References add_tiles_bottom(), add_tiles_left(), add_tiles_right(), add_tiles_top(), gamemap::h(), gamemap::MAX_PLAYERS, t_translation::NONE_TERRAIN, remove_tiles_bottom(), remove_tiles_left(), remove_tiles_right(), remove_tiles_top(), gamemap::startingPositions_, gamemap::w(), gamemap::write(), gamemap::location::x, and gamemap::location::y.
Referenced by map_editor::resize_map().
std::string editormap::flip | ( | const map_editor::FLIP_AXIS | axis | ) |
Flips the map over an axis.
axis | the axis to flip the map over |
Definition at line 99 of file map_manip.cpp.
References boost::foreach_detail_::end(), map_editor::FLIP_X, map_editor::FLIP_Y, size, swap_starting_position(), gamemap::tiles_, and gamemap::write().
Referenced by map_editor::flip_map().
void editormap::set_starting_position | ( | const int | pos, | |
const location | loc | |||
) |
Sets the starting position of a player.
Definition at line 148 of file map_manip.cpp.
References gamemap::startingPositions_.
Referenced by swap_starting_position().
void editormap::swap_starting_position | ( | const size_t | x1, | |
const size_t | y1, | |||
const size_t | x2, | |||
const size_t | y2 | |||
) | [private] |
Exchanges starting positions, If there's a starting location on x1, y1 it will be moved to x2, y2.
If x2, y2 contains a starting location this is moved to x1, y1. The function also works if both locations contain a starting position.
Definition at line 152 of file map_manip.cpp.
References gamemap::is_starting_position(), and set_starting_position().
Referenced by flip().
void editormap::add_tiles_right | ( | const unsigned | count, | |
const t_translation::t_terrain & | filler | |||
) | [private] |
Adds column(s) at the right side.
count | the number of columns to add | |
filler | the terrain to draw, if equal to NONE_TERRAIN the enigne will determine the terrain by itself |
Definition at line 167 of file map_manip.cpp.
References t_translation::NONE_TERRAIN, size, and gamemap::tiles_.
Referenced by resize().
void editormap::add_tiles_left | ( | const unsigned | count, | |
const t_translation::t_terrain & | filler | |||
) | [private] |
Adds column(s) at the left side.
count | the number of columns to add | |
filler | the terrain to draw, if equal to NONE_TERRAIN the enigne will determine the terrain by itself |
Definition at line 184 of file map_manip.cpp.
References gamemap::clear_border_cache(), t_translation::NONE_TERRAIN, size, and gamemap::tiles_.
Referenced by resize().
void editormap::remove_tiles_right | ( | const unsigned | count | ) | [private] |
Removes column(s) at the right side.
count | the number of columns to remove |
Definition at line 202 of file map_manip.cpp.
References _, and gamemap::tiles_.
Referenced by resize().
void editormap::remove_tiles_left | ( | const unsigned | count | ) | [private] |
Removes column(s) at the left side.
count | the number of columns to remove |
Definition at line 216 of file map_manip.cpp.
References _, and gamemap::tiles_.
Referenced by resize().
void editormap::add_tiles_top | ( | const unsigned | count, | |
const t_translation::t_terrain & | filler | |||
) | [private] |
Adds row(s) at the top side.
count | the number of rows to add | |
filler | the terrain to draw, if equal to NONE_TERRAIN the enigne will determine the terrain by itself |
Definition at line 230 of file map_manip.cpp.
References boost::foreach_detail_::begin(), gamemap::clear_border_cache(), t_translation::NONE_TERRAIN, and gamemap::tiles_.
Referenced by resize().
void editormap::add_tiles_bottom | ( | const unsigned | count, | |
const t_translation::t_terrain & | filler | |||
) | [private] |
Adds row(s) at the bottom side.
count | the number of rows to add | |
filler | the terrain to draw, if equal to NONE_TERRAIN the enigne will determine the terrain by itself |
Definition at line 247 of file map_manip.cpp.
References t_translation::NONE_TERRAIN, and gamemap::tiles_.
Referenced by resize().
void editormap::remove_tiles_top | ( | const unsigned | count | ) | [private] |
Removes row(s) at the top side.
count | the number of rows to remove |
Definition at line 263 of file map_manip.cpp.
References _, boost::foreach_detail_::begin(), size, and gamemap::tiles_.
Referenced by resize().
void editormap::remove_tiles_bottom | ( | const unsigned | count | ) | [private] |
Removes row(s) at the bottom side.
count | the number of rows to remove |
Definition at line 279 of file map_manip.cpp.
References _, boost::foreach_detail_::end(), size, and gamemap::tiles_.
Referenced by resize().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |