17 #ifndef MAP_H_INCLUDED
18 #define MAP_H_INCLUDED
26 #include <boost/shared_ptr.hpp>
105 int w()
const {
return w_; }
108 int h()
const {
return h_; }
159 return w_ == 0 ||
h_ == 0;
205 const std::string &yvals,
bool with_border =
false)
const;
int total_width() const
Real width of the map, including borders.
bool on_board_with_border(const map_location &loc) const
const tstarting_positions & special_locations() const
boost::bimaps::bimap< boost::bimaps::set_of< std::string >, boost::bimaps::multiset_of< coordinate >> tstarting_positions
std::vector< map_location > villages_
std::string get_underlying_terrain_string(const t_translation::t_terrain &terrain) const
std::string get_terrain_editor_string(const map_location &loc) const
const t_translation::t_list & get_terrain_list() const
Gets the list of terrains.
int border_size_
The size of the border around the map.
bool is_village(const map_location &loc) const
tdata_cache tdata_
Allows lookup of terrain at a particular location.
static const int default_border
The default border style for a map.
std::map< map_location, t_translation::t_terrain > borderCache_
GLint GLint GLint GLint GLint GLint y
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
std::map< t_translation::t_terrain, size_t > terrainFrequencyCache_
const t_translation::t_list & underlying_union_terrain(const map_location &loc) const
std::string get_terrain_string(const map_location &loc) const
const tdata_cache & tdata() const
int total_height() const
Real height of the map, including borders.
std::vector< std::vector< t_terrain > > t_map
const t_translation::t_terrain operator[](const map_location &loc) const
gamemap(const tdata_cache &tdata, const std::string &data)
Loads a map, with the given terrain configuration.
map_location starting_position(int side) const
int w() const
Effective map width.
t_translation::tstarting_positions tstarting_positions
Encapsulates the map of the game.
void set_special_location(const std::string &id, const map_location &loc)
bool empty() const
Tell if the map is of 0 size.
int border_size() const
Size of the map border.
int w_
Sizes of the map area.
static const ::config * terrain
The terrain used to create the cache.
void read(const std::string &data, const bool allow_invalid=true, const int border_size=1)
const std::map< t_translation::t_terrain, size_t > & get_weighted_terrain_frequencies() const
Returns a list of the frequencies of different terrain types on the map, with terrain nearer the cent...
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
Encapsulates the map of the game.
const terrain_type & get_terrain_info(const t_translation::t_terrain &terrain) const
std::vector< map_location > parse_location_range(const std::string &xvals, const std::string &yvals, bool with_border=false) const
Parses ranges of locations into a vector of locations, using this map's dimensions as bounds...
std::string write() const
map_location special_location(const std::string &id) const
int h() const
Effective map height.
GLint GLint GLint GLint GLint x
bool is_castle(const map_location &loc) const
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 write_terrain(const map_location &loc, config &cfg) const
Writes the terrain at loc to cfg.
t_translation::t_terrain get_terrain(const map_location &loc) const
Looks up terrain at a particular location.
GLint GLint GLsizei GLsizei GLsizei GLint border
bool on_board(const map_location &loc) const
Tell if a location is on the map.
tstarting_positions starting_positions_
The size of the starting positions array is MAX_PLAYERS + 1, because the positions themselves are num...
int read_header(const std::string &data)
Reads the header of a map which is saved in the deprecated map_data format.
void remove_from_border_cache(const map_location &loc)
Remove the cached border terrain at loc.
int num_valid_starting_positions() const
int total_width_
Sizes of the map including the borders.
void set_starting_position(int side, const map_location &loc)
Manipulate starting positions of the different sides.
const std::string * is_starting_position(const map_location &loc) const
returns the side number of the side starting at position loc, 0 if no such side exists.
const t_translation::t_list & underlying_def_terrain(const map_location &loc) const
void overlay(const gamemap &m, const config &rules, int x=0, int y=0, bool border=false)
Overlays another map onto this one at the given position.
t_translation::t_map tiles_
A config object defines a single node in a WML file, with access to child nodes.
const t_translation::t_list & underlying_mvt_terrain(const map_location &loc) const
const std::vector< map_location > & villages() const
Return a list of the locations of villages on the map.
GLsizei const GLcharARB ** string
void clear_border_cache()
Clears the border cache, needed for the editor.
bool is_keep(const map_location &loc) const
std::vector< t_terrain > t_list
int gives_healing(const map_location &loc) const