The Battle for Wesnoth  1.15.12+dev
Namespaces | Macros | Functions | Variables
translation.cpp File Reference

Routines for terrain-conversion. More...

#include "gettext.hpp"
#include "lexical_cast.hpp"
#include "log.hpp"
#include "terrain/translation.hpp"
#include "serialization/string_utils.hpp"
#include "utils/iterable_pair.hpp"
#include "wml_exception.hpp"
Include dependency graph for translation.cpp:

Go to the source code of this file.




#define GETTEXT_DOMAIN   "wesnoth-lib"
#define ERR_G   LOG_STREAM(err, lg::general())
#define WRN_G   LOG_STREAM(warn, lg::general())


int t_translation::max_map_size ()
 Return the maximum allowed map size (in either dimension), the maximum map area is, therefore, this value squared. More...
static ter_layer t_translation::get_layer_mask_ (ter_layer terrain)
 Get the mask for a single layer. More...
static terrain_code t_translation::get_mask_ (const terrain_code &terrain)
 Gets a mask for a terrain, this mask is used for wildcard matching. More...
static ter_layer t_translation::string_to_layer_ (std::string_view str)
static ter_layer t_translation::string_to_layer_ (const std::string &str)
 Converts a string to a layer. More...
static terrain_code t_translation::string_to_number_ (std::string_view str, std::vector< std::string > &start_positions, const ter_layer filler)
 Converts a terrain string to a number. More...
static terrain_code t_translation::string_to_number_ (std::string_view str, const ter_layer filler=NO_LAYER)
static std::string t_translation::number_to_string_ (terrain_code terrain, const std::vector< std::string > &start_position=std::vector< std::string >())
 Converts a terrain number to a string. More...
static terrain_code t_translation::string_to_builder_number_ (std::string str)
 Converts a terrain string to a number for the builder. More...
const ter_match t_translation::ALL_OFF_MAP ("_off^_usr,*^_fme")
const ter_match t_translation::ALL_FORESTS ("F*,*^F*")
terrain_code t_translation::read_terrain_code (std::string_view str, const ter_layer filler=NO_LAYER)
 Reads a single terrain from a string. More...
std::string t_translation::write_terrain_code (const terrain_code &tcode)
 Writes a single terrain code to a string. More...
ter_list t_translation::read_list (std::string_view str, const ter_layer filler=NO_LAYER)
 Reads a list of terrains from a string, when reading the. More...
std::string t_translation::write_list (const ter_list &list)
 Writes a list of terrains to a string, only writes the new format. More...
static std::pair< int, int > t_translation::get_map_size (const char *begin, const char *end)
ter_map t_translation::read_game_map (std::string_view str, starting_positions &positions, coordinate border_offset=coordinate{ 0, 0 })
 Reads a gamemap string into a 2D vector. More...
std::string t_translation::write_game_map (const ter_map &map, const starting_positions &positions=starting_positions(), coordinate border_offset=coordinate{ 0, 0 })
 Write a gamemap in to a vector string. More...
bool t_translation::terrain_matches (const terrain_code &src, const terrain_code &dest)
 Tests whether a specific terrain matches an expression, for matching rules see above. More...
bool t_translation::terrain_matches (const terrain_code &src, const ter_list &dest)
 Tests whether a specific terrain matches a list of expressions. More...
bool t_translation::terrain_matches (const terrain_code &src, const ter_match &dest)
 Tests whether a certain terrain matches a list of expressions, for matching rules see above. More...
bool t_translation::has_wildcard (const terrain_code &tcode)
 Tests whether a terrain code contains a wildcard. More...
bool t_translation::has_wildcard (const ter_list &list)
 Tests whether a terrain-code list contains at least one item with a wildcard. More...
ter_map t_translation::read_builder_map (const std::string &str)
 Reads a builder map. More...


const terrain_code t_translation::OFF_MAP_USER = string_to_number_("_off^_usr")
const terrain_code t_translation::VOID_TERRAIN = string_to_number_("_s")
 VOID_TERRAIN is used for shrouded hexes. More...
const terrain_code t_translation::FOGGED = string_to_number_("_f")
const terrain_code t_translation::HUMAN_CASTLE = string_to_number_("Ch")
const terrain_code t_translation::HUMAN_KEEP = string_to_number_("Kh")
const terrain_code t_translation::SHALLOW_WATER = string_to_number_("Ww")
const terrain_code t_translation::DEEP_WATER = string_to_number_("Wo")
const terrain_code t_translation::GRASS_LAND = string_to_number_("Gg")
const terrain_code t_translation::FOREST = string_to_number_("Gg^Ff")
const terrain_code t_translation::MOUNTAIN = string_to_number_("Mm")
const terrain_code t_translation::HILL = string_to_number_("Hh")
const terrain_code t_translation::CAVE_WALL = string_to_number_("Xu")
const terrain_code t_translation::CAVE = string_to_number_("Uu")
const terrain_code t_translation::UNDERGROUND_VILLAGE = string_to_number_("Uu^Vu")
const terrain_code t_translation::DWARVEN_CASTLE = string_to_number_("Cud")
const terrain_code t_translation::DWARVEN_KEEP = string_to_number_("Kud")
const terrain_code t_translation::PLUS = string_to_number_("+")
const terrain_code t_translation::MINUS = string_to_number_("-")
const terrain_code t_translation::NOT = string_to_number_("!")
const terrain_code t_translation::STAR = string_to_number_("*")
const terrain_code t_translation::BASE = string_to_number_("_bas")
const ter_match t_translation::ALL_HILLS ("!,*^V*,!,H*")
const ter_match t_translation::ALL_MOUNTAINS ("!,*^V*,!,M*")
const ter_match t_translation::ALL_SWAMPS ("!,*^V*,*^B*,!,S*")

Detailed Description

Routines for terrain-conversion.

Definition in file translation.cpp.

Macro Definition Documentation


#define ERR_G   LOG_STREAM(err, lg::general())

Definition at line 31 of file translation.cpp.

Referenced by t_translation::read_game_map().


#define GETTEXT_DOMAIN   "wesnoth-lib"

Definition at line 20 of file translation.cpp.


#define WRN_G   LOG_STREAM(warn, lg::general())

Definition at line 32 of file translation.cpp.

Referenced by t_translation::read_game_map().