The Battle for Wesnoth  1.15.12+dev
Public Member Functions | List of all members
mapgen_gamemap Class Reference

#include <lua_terrainmap.hpp>

Inheritance diagram for mapgen_gamemap:

Public Member Functions

 mapgen_gamemap (std::string_view data)
 
 mapgen_gamemap (int w, int h, terrain_code)
 
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. More...
 
template<typename F >
void for_each_loc (const F &f) const
 
- Public Member Functions inherited from gamemap_base
virtual ~gamemap_base ()
 
std::string to_string () const
 
int w () const
 Effective map width. More...
 
int h () const
 Effective map height. More...
 
int border_size () const
 Size of the map border. More...
 
int total_width () const
 Real width of the map, including borders. More...
 
int total_height () const
 Real height of the map, including borders. More...
 
bool empty () const
 Tell if the map is of 0 size. More...
 
bool on_board (const map_location &loc) const
 Tell if a location is on the map. More...
 
bool on_board_with_border (const map_location &loc) const
 
terrain_code get_terrain (const map_location &loc) const
 Looks up terrain at a particular location. More...
 
location_mapspecial_locations ()
 
const location_mapspecial_locations () const
 
const std::vector< map_locationstarting_positions () const
 
void set_special_location (const std::string &id, const map_location &loc)
 
map_location special_location (const std::string &id) const
 
void set_starting_position (int side, const map_location &loc)
 Manipulate starting positions of the different sides. More...
 
map_location starting_position (int side) const
 
int num_valid_starting_positions () const
 Counts the number of sides that have valid starting positions on this map. More...
 
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. More...
 
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. More...
 
std::vector< map_locationparse_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. More...
 
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. More...
 
template<typename F >
void for_each_loc (const F &f) const
 
template<typename F >
void for_each_walkable_loc (const F &f) const
 

Additional Inherited Members

- Public Types inherited from gamemap_base
using terrain_code = t_translation::terrain_code
 
using terrain_map = t_translation::ter_map
 
using location_map = t_translation::starting_positions
 
- Static Public Attributes inherited from gamemap_base
static const int default_border = 1
 The default border style for a map. More...
 
static const int MAX_PLAYERS = 9
 Maximum number of players supported. More...
 
- Protected Member Functions inherited from gamemap_base
 gamemap_base ()=default
 
 gamemap_base (int w, int h, terrain_code default_ter=terrain_code())
 
terrain_maptiles ()
 
const terrain_maptiles () const
 

Detailed Description

Definition at line 30 of file lua_terrainmap.hpp.

Constructor & Destructor Documentation

◆ mapgen_gamemap() [1/2]

mapgen_gamemap::mapgen_gamemap ( std::string_view  data)
explicit

Definition at line 108 of file lua_terrainmap.cpp.

References t_translation::read_game_map().

Referenced by intf_terrain_mask().

◆ mapgen_gamemap() [2/2]

mapgen_gamemap::mapgen_gamemap ( int  w,
int  h,
terrain_code  t 
)

Definition at line 118 of file lua_terrainmap.cpp.

Member Function Documentation

◆ for_each_loc()

template<typename F >
void mapgen_gamemap::for_each_loc ( const F &  f) const
inline

◆ set_terrain()

void mapgen_gamemap::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 
)
overridevirtual

Clobbers over the terrain at location 'loc', with the given terrain.

Uses mode and replace_if_failed like merge_terrains().

Implements gamemap_base.

Definition at line 142 of file lua_terrainmap.cpp.

References gamemap_base::border_size(), t_translation::ter_map::get(), gamemap_base::get_terrain(), simplemerge(), t, gamemap_base::tiles(), map_location::x, and map_location::y.


The documentation for this class was generated from the following files: