editormap Class Reference

#include <map_manip.hpp>

Inheritance diagram for editormap:

Inheritance graph
[legend]
Collaboration diagram for editormap:

Collaboration graph
[legend]

List of all members.

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.


Detailed Description

Definition at line 38 of file map_manip.hpp.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Parameters:
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
Returns:
if there's been a modification to the map: the new map data as string, else an empty string

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.

Parameters:
axis the axis to flip the map over
Returns:
if there's been a modification to the map the new map data as string else an empty string

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.

Parameters:
pos the starting position, 1 = player 1
loc a location (same as gamemap location)

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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().


The documentation for this class was generated from the following files:

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs