21 #include <boost/bimap.hpp>
22 #include <boost/bimap/set_of.hpp>
23 #include <boost/bimap/multiset_of.hpp>
28 #include <string_view>
61 {
return std::tie(a.
base, a.
overlay) < std::tie(
b.base,
b.overlay); };
92 std::vector<terrain_code>
data;
96 std::vector<terrain_code>::const_iterator
operator[](
int x)
const {
return data.begin() +
static_cast<size_t>(
h) * x; }
131 extern const terrain_code
FOGGED;
141 extern const terrain_code
FOREST;
143 extern const terrain_code
HILL;
146 extern const terrain_code
CAVE;
151 extern const terrain_code
PLUS;
152 extern const terrain_code
MINUS;
153 extern const terrain_code
NOT;
154 extern const terrain_code
STAR;
155 extern const terrain_code
BASE;
217 using starting_positions = boost::bimaps::bimap<boost::bimaps::set_of<std::string>, boost::bimaps::multiset_of<coordinate>>;
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.
terrain_code read_terrain_code(std::string_view str, const ter_layer filler)
Reads a single terrain from a string.
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 CAVE_WALL
const ter_match ALL_FORESTS
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 VOID_TERRAIN
VOID_TERRAIN is used for shrouded hexes.
const terrain_code SHALLOW_WATER
const terrain_code DWARVEN_KEEP
const terrain_code UNDERGROUND_VILLAGE
const ter_match ALL_SWAMPS("!,*^V*,*^B*,!,S*")
std::ostream & operator<<(std::ostream &s, const terrain_code &a)
const terrain_code HUMAN_CASTLE
int max_map_size()
Return the maximum allowed map size (in either dimension), the maximum map area is,...
bool has_wildcard(const terrain_code &tcode)
Tests whether a terrain code contains a wildcard.
terrain_code operator&(const terrain_code &a, const terrain_code &b)
bool terrain_matches(const terrain_code &src, const terrain_code &dest)
Tests whether a specific terrain matches an expression, for matching rules see above.
std::vector< terrain_code > ter_list
const terrain_code GRASS_LAND
const ter_match ALL_OFF_MAP
bool operator!=(const terrain_code &a, const terrain_code &b)
const terrain_code DEEP_WATER
boost::bimaps::bimap< boost::bimaps::set_of< std::string >, boost::bimaps::multiset_of< coordinate > > starting_positions
const ter_match ALL_HILLS("!,*^V*,!,H*")
ter_map read_builder_map(const std::string &str)
Reads a builder map.
const terrain_code FOREST
ter_list read_list(std::string_view str, const ter_layer filler)
Reads a list of terrains from a string, when reading the.
terrain_code operator|(const terrain_code &a, const terrain_code &b)
const ter_match ALL_MOUNTAINS("!,*^V*,!,M*")
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
const terrain_code MOUNTAIN
bool operator<(const terrain_code &a, const terrain_code &b)
const terrain_code DWARVEN_CASTLE
std::string write_terrain_code(const terrain_code &tcode)
Writes a single terrain code to a string.
const terrain_code FOGGED
const terrain_code OFF_MAP_USER
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.
const terrain_code HUMAN_KEEP
const terrain_code NONE_TERRAIN
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.
std::string::const_iterator iterator
rect src
Non-transparent portion of the surface to compose.
Base class for all the errors encountered by the engine.
Encapsulates the map of the game.
error(const std::string &message)
ter_map(const ter_map &)=default
ter_map(ter_map &&)=default
std::vector< terrain_code >::const_iterator operator[](int x) const
terrain_code & get(int x, int y)
std::vector< terrain_code > data
std::vector< terrain_code >::iterator operator[](int x)
const terrain_code & get(int x, int y) const
ter_map & operator=(const ter_map &)=default
ter_map(int w, int h, terrain_code fill=terrain_code())
This structure can be used for matching terrain strings.
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
terrain_code(ter_layer b, ter_layer o)
static map_location::direction s