The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Macros | Functions | Variables
translation.cpp File Reference

Routines for terrain-conversion. More...

#include "global.hpp"
#include "gettext.hpp"
#include "log.hpp"
#include "terrain/translation.hpp"
#include "serialization/string_utils.hpp"
#include "util.hpp"
#include "wml_exception.hpp"
Include dependency graph for translation.cpp:

Go to the source code of this file.

Namespaces

 t_translation
 

Macros

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

Functions

size_t 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 t_layer t_translation::get_layer_mask_ (t_layer terrain)
 Get the mask for a single layer. More...
 
static t_terrain t_translation::get_mask_ (const t_terrain &terrain)
 Gets a mask for a terrain, this mask is used for wildcard matching. More...
 
static t_layer t_translation::string_to_layer_ (const char *begin, const char *end)
 Converts a string to a layer. More...
 
static t_layer t_translation::string_to_layer_ (const std::string &str)
 
static t_terrain t_translation::string_to_number_ (std::string str, std::string &start_position, const t_layer filler)
 Converts a terrain string to a number. More...
 
static t_terrain t_translation::string_to_number_ (const std::string &str, const t_layer filler=NO_LAYER)
 
static std::string t_translation::number_to_string_ (t_terrain terrain, const std::string &start_position="")
 Converts a terrain number to a string. More...
 
static t_terrain t_translation::string_to_builder_number_ (std::string str)
 Converts a terrain string to a number for the builder. More...
 
const t_match t_translation::ALL_FORESTS ("F*,*^F*")
 
t_terrain t_translation::read_terrain_code (const std::string &str, const t_layer filler=NO_LAYER)
 Reads a single terrain from a string. More...
 
std::string t_translation::write_terrain_code (const t_terrain &tcode)
 Writes a single terrain code to a string. More...
 
t_list t_translation::read_list (const std::string &str, const t_layer filler=NO_LAYER)
 Reads a list of terrains from a string, when reading the. More...
 
std::string t_translation::write_list (const t_list &list)
 Writes a list of terrains to a string, only writes the new format. More...
 
t_map t_translation::read_game_map (const std::string &str, tstarting_positions &starting_positions, coordinate border_offset=coordinate{0, 0})
 Reads a gamemap string into a 2D vector. More...
 
std::string t_translation::write_game_map (const t_map &map, const tstarting_positions &starting_positions=tstarting_positions(), coordinate border_offset=coordinate{0, 0})
 Write a gamemap in to a vector string. More...
 
bool t_translation::terrain_matches (const t_terrain &src, const t_terrain &dest)
 Tests whether a specific terrain matches an expression, for matching rules see above. More...
 
bool t_translation::terrain_matches (const t_terrain &src, const t_list &dest)
 Tests whether a specific terrain matches a list of expressions. More...
 
bool t_translation::terrain_matches (const t_terrain &src, const t_match &dest)
 Tests whether a certain terrain matches a list of expressions, for matching rules see above. More...
 
bool t_translation::has_wildcard (const t_terrain &tcode)
 Tests whether a terrain code contains a wildcard. More...
 
bool t_translation::has_wildcard (const t_list &list)
 Tests whether a terrain-code list contains at least one item with a wildcard. More...
 
t_map t_translation::read_builder_map (const std::string &str)
 Reads a builder map. More...
 

Variables

const t_terrain t_translation::OFF_MAP_USER = string_to_number_("_off^_usr")
 
const t_terrain t_translation::VOID_TERRAIN = string_to_number_("_s")
 
const t_terrain t_translation::FOGGED = string_to_number_("_f")
 
const t_terrain t_translation::HUMAN_CASTLE = string_to_number_("Ch")
 
const t_terrain t_translation::HUMAN_KEEP = string_to_number_("Kh")
 
const t_terrain t_translation::SHALLOW_WATER = string_to_number_("Ww")
 
const t_terrain t_translation::DEEP_WATER = string_to_number_("Wo")
 
const t_terrain t_translation::GRASS_LAND = string_to_number_("Gg")
 
const t_terrain t_translation::FOREST = string_to_number_("Gg^Ff")
 
const t_terrain t_translation::MOUNTAIN = string_to_number_("Mm")
 
const t_terrain t_translation::HILL = string_to_number_("Hh")
 
const t_terrain t_translation::CAVE_WALL = string_to_number_("Xu")
 
const t_terrain t_translation::CAVE = string_to_number_("Uu")
 
const t_terrain t_translation::UNDERGROUND_VILLAGE = string_to_number_("Uu^Vu")
 
const t_terrain t_translation::DWARVEN_CASTLE = string_to_number_("Cud")
 
const t_terrain t_translation::DWARVEN_KEEP = string_to_number_("Kud")
 
const t_terrain t_translation::PLUS = string_to_number_("+")
 
const t_terrain t_translation::MINUS = string_to_number_("-")
 
const t_terrain t_translation::NOT = string_to_number_("!")
 
const t_terrain t_translation::STAR = string_to_number_("*")
 
const t_terrain t_translation::BASE = string_to_number_("_bas")
 
const t_match t_translation::ALL_HILLS ("!,*^V*,!,H*")
 
const t_match t_translation::ALL_MOUNTAINS ("!,*^V*,!,M*")
 
const t_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().