21 #include <boost/bimap.hpp> 22 #include <boost/bimap/set_of.hpp> 23 #include <boost/bimap/multiset_of.hpp> 28 #include <string_view> 51 explicit terrain_code(
const std::string& b, ter_layer o = NO_LAYER);
92 std::vector<terrain_code>
data;
96 std::vector<terrain_code>::const_iterator
operator[](
int x)
const {
return data.begin() + h * x; }
106 ter_match(std::string_view str,
const ter_layer filler = NO_LAYER);
206 ter_list
read_list(std::string_view str,
const ter_layer filler = NO_LAYER);
218 using starting_positions = boost::bimaps::bimap<boost::bimaps::set_of<std::string>, boost::bimaps::multiset_of<coordinate>>;
ter_map(int w, int h, terrain_code fill=terrain_code())
const terrain_code NONE_TERRAIN
const terrain_code FOREST
boost::bimaps::bimap< boost::bimaps::set_of< std::string >, boost::bimaps::multiset_of< coordinate > > starting_positions
const terrain_code DWARVEN_KEEP
error(const std::string &message)
bool terrain_matches(const terrain_code &src, const terrain_code &dest)
Tests whether a specific terrain matches an expression, for matching rules see above.
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
std::vector< terrain_code > data
ter_map read_game_map(std::string_view str, starting_positions &starting_positions, coordinate border_offset)
Reads a gamemap string into a 2D vector.
const terrain_code HUMAN_KEEP
const ter_match ALL_MOUNTAINS("!,*^V*,!,M*")
terrain_code read_terrain_code(std::string_view str, const ter_layer filler)
Reads a single terrain from a string.
terrain_code(ter_layer b, ter_layer o)
const terrain_code VOID_TERRAIN
VOID_TERRAIN is used for shrouded hexes.
std::vector< terrain_code >::const_iterator operator[](int x) const
int max_map_size()
Return the maximum allowed map size (in either dimension), the maximum map area is, therefore, this value squared.
const terrain_code MOUNTAIN
std::ostream & operator<<(std::ostream &s, const terrain_code &a)
bool operator<(const terrain_code &a, const terrain_code &b)
const terrain_code FOGGED
const terrain_code DWARVEN_CASTLE
const ter_match ALL_HILLS("!,*^V*,!,H*")
const terrain_code OFF_MAP_USER
std::string write_terrain_code(const terrain_code &tcode)
Writes a single terrain code to a string.
const terrain_code HUMAN_CASTLE
terrain_code operator &(const terrain_code &a, const terrain_code &b)
Encapsulates the map of the game.
std::vector< terrain_code >::iterator operator[](int x)
const ter_match ALL_SWAMPS("!,*^V*,*^B*,!,S*")
bool operator==(const terrain_code &a, const terrain_code &b)
terrain_code operator|(const terrain_code &a, const terrain_code &b)
static map_location::DIRECTION s
ter_map read_builder_map(const std::string &str)
Reads a builder map.
bool operator!=(const terrain_code &a, const terrain_code &b)
std::string write_list(const ter_list &list)
Writes a list of terrains to a string, only writes the new format.
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
const terrain_code CAVE_WALL
bool has_wildcard(const terrain_code &tcode)
Tests whether a terrain code contains a wildcard.
std::string write_game_map(const ter_map &map, const starting_positions &starting_positions, coordinate border_offset)
Write a gamemap in to a vector string.
const terrain_code DEEP_WATER
const ter_match ALL_OFF_MAP
Base class for all the errors encountered by the engine.
const terrain_code UNDERGROUND_VILLAGE
std::vector< terrain_code > ter_list
const terrain_code SHALLOW_WATER
This structure can be used for matching terrain strings.
void fill(const SDL_Rect &rect, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
Fill an area with the given colour.
std::string::const_iterator iterator
const terrain_code GRASS_LAND
ter_list read_list(std::string_view str, const ter_layer filler)
Reads a list of terrains from a string, when reading the.
const ter_match ALL_FORESTS