67 return w() <= 0 ||
h() <= 0;
109 std::vector<map_location>
parse_location_range(
const std::string& xvals,
const std::string &yvals,
bool with_border =
false)
const;
116 utils::optional<t_translation::terrain_code>
terrain_;
148 for(
int x = 0; x <
w(); ++x) {
149 for(
int y = 0; y <
h(); ++y) {
204 const std::shared_ptr<terrain_type_data>&
tdata()
const {
return tdata_; }
216 void read(
const std::string&
data,
const bool allow_invalid =
true);
218 std::string
write()
const;
254 std::shared_ptr<terrain_type_data>
tdata_;
A config object defines a single node in a WML file, with access to child nodes.
void for_each_walkable_loc(const F &f) const
terrain_code get_terrain(const map_location &loc) const
Looks up terrain at a particular location.
int w() const
Effective map width.
void set_starting_position(int side, const map_location &loc)
Manipulate starting positions of the different sides.
t_translation::starting_positions location_map
void set_special_location(const std::string &id, const map_location &loc)
int h() const
Effective map height.
void overlay(const gamemap_base &m, map_location loc, const std::vector< overlay_rule > &rules=std::vector< overlay_rule >(), bool is_odd=false, bool ignore_special_locations=false)
Overlays another map onto this one at the given position.
static const int MAX_PLAYERS
Maximum number of players supported.
map_location special_location(const std::string &id) 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.
map_location starting_position(int side) const
virtual 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)=0
Clobbers over the terrain at location 'loc', with the given terrain.
t_translation::terrain_code terrain_code
void for_each_loc(const F &f) const
int total_width() const
Real width of the map, including borders.
const location_map & special_locations() const
const terrain_map & tiles() const
std::string to_string() const
int num_valid_starting_positions() const
Counts the number of sides that have valid starting positions on this map.
bool on_board_with_border(const map_location &loc) const
static const int default_border
The default border style for a map.
int total_height() const
Real height of the map, including borders.
int 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.
bool empty() const
Tell if the map is of 0 size.
location_map starting_positions_
const std::string * is_special_location(const map_location &loc) const
returns the name of the special location at position loc, null if no such location exists.
int border_size() const
Size of the map border.
const std::vector< map_location > starting_positions() const
bool on_board(const map_location &loc) const
Tell if a location is on the map.
location_map & special_locations()
Encapsulates the map of the game.
const t_translation::ter_list & underlying_union_terrain(const map_location &loc) const
bool is_village(const map_location &loc) const
t_translation::terrain_code & operator[](const map_location &loc)
std::string get_underlying_terrain_string(const t_translation::terrain_code &terrain) const
bool is_castle(const map_location &loc) const
void read(const std::string &data, const bool allow_invalid=true)
const t_translation::terrain_code operator[](const map_location &loc) const
const t_translation::ter_list & underlying_mvt_terrain(const map_location &loc) const
const t_translation::ter_list & underlying_def_terrain(const map_location &loc) const
const t_translation::ter_list & get_terrain_list() const
Gets the list of terrains.
std::string write() const
std::vector< map_location > villages_
std::string get_terrain_editor_string(const map_location &loc) const
void write_terrain(const map_location &loc, config &cfg) const
Writes the terrain at loc to cfg.
gamemap(const std::string &data)
Loads a map.
const std::vector< map_location > & villages() const
Return a list of the locations of villages on the map.
bool is_keep(const map_location &loc) const
std::string get_terrain_string(const map_location &loc) const
std::shared_ptr< terrain_type_data > tdata_
const terrain_type & get_terrain_info(const t_translation::terrain_code &terrain) const
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.
int gives_healing(const map_location &loc) const
const std::shared_ptr< terrain_type_data > & tdata() const
int read_header(const std::string &data)
Reads the header of a map which is saved in the deprecated map_data format.
Contains the database of all known terrain types, both those defined explicitly by WML [terrain_type]...
constexpr bool is_odd(T num)
std::vector< terrain_code > ter_list
boost::bimaps::bimap< boost::bimaps::set_of< std::string >, boost::bimaps::multiset_of< coordinate > > starting_positions
terrain_type_data::merge_mode mode_
t_translation::ter_list new_
utils::optional< t_translation::terrain_code > terrain_
t_translation::ter_list old_
Encapsulates the map of the game.
terrain_code & get(int x, int y)
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...