The Battle for Wesnoth  1.15.2+dev
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
mapgen_gamemap Class Reference

#include <lua_terrainmap.hpp>

Public Types

using terrain_code = t_translation::terrain_code
 
using terrain_map = t_translation::ter_map
 
using starting_positions = t_translation::starting_positions
 

Public Member Functions

 mapgen_gamemap (utils::string_view data)
 
 mapgen_gamemap (int w, int h, terrain_code)
 
std::string to_string () const
 
int w () const
 Effective map width. More...
 
int h () const
 Effective map height. 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 on_map (const map_location &loc) const
 
bool on_map_noborder (const map_location &loc) const
 
terrain_codeoperator[] (const map_location &loc)
 
const terrain_codeoperator[] (const map_location &loc) const
 
void set_terrain (const map_location &loc, const terrain_code &terrain, const terrain_type_data::merge_mode mode)
 
starting_positionsspecial_locations ()
 
const starting_positionsspecial_locations () const
 
void set_special_location (const std::string &id, const map_location &loc)
 
map_location special_location (const std::string &id) const
 
template<typename F >
void for_each_loc (const F &f) const
 

Static Public Member Functions

static void simplemerge (terrain_code old, terrain_code &t, const terrain_type_data::merge_mode mode)
 
static int intf_mg_terrain_mask (lua_State *L)
 Reaplces part of the map. More...
 

Private Attributes

t_translation::ter_map tiles_
 
starting_positions starting_positions_
 

Detailed Description

Definition at line 30 of file lua_terrainmap.hpp.

Member Typedef Documentation

◆ starting_positions

Definition at line 35 of file lua_terrainmap.hpp.

◆ terrain_code

Definition at line 33 of file lua_terrainmap.hpp.

◆ terrain_map

Definition at line 34 of file lua_terrainmap.hpp.

Constructor & Destructor Documentation

◆ mapgen_gamemap() [1/2]

mapgen_gamemap::mapgen_gamemap ( utils::string_view  data)
explicit

Referenced by impl_slocs_set(), and luaW_pushmap().

◆ mapgen_gamemap() [2/2]

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

Definition at line 133 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

Definition at line 83 of file lua_terrainmap.hpp.

References f, intf_mg_terrain_mask(), total_height(), and total_width().

Referenced by intf_mg_get_locations_part2().

◆ h()

int mapgen_gamemap::h ( ) const
inline

Effective map height.

Definition at line 45 of file lua_terrainmap.hpp.

References total_height().

Referenced by intf_terainmap_create().

◆ intf_mg_terrain_mask()

int mapgen_gamemap::intf_mg_terrain_mask ( lua_State L)
static

Reaplces part of the map.

  • Arg 1: map location.
  • Arg 2: map data string.
  • Arg 3: table for optional named arguments
    • is_odd: boolen, if Arg2 has the odd mapo format (as if it was cut from a odd map location)
    • ignore_special_locations: boolean
    • rules: table of tables

Definition at line 407 of file lua_terrainmap.cpp.

References is_odd(), lua_istable, lua_pop, luaL_argerror(), luaW_checklocation(), luaW_checkterrainmap(), luaW_tableget(), gamemap::overlay_impl(), read_rules_vector(), starting_positions_, t, and tiles_.

Referenced by for_each_loc(), and lua_terrainmap::register_metatables().

◆ on_map()

bool mapgen_gamemap::on_map ( const map_location loc) const
inline

◆ on_map_noborder()

bool mapgen_gamemap::on_map_noborder ( const map_location loc) const
inline

◆ operator[]() [1/2]

terrain_code& mapgen_gamemap::operator[] ( const map_location loc)
inline

◆ operator[]() [2/2]

const terrain_code& mapgen_gamemap::operator[] ( const map_location loc) const
inline

◆ set_special_location()

void mapgen_gamemap::set_special_location ( const std::string &  id,
const map_location loc 
)

Definition at line 164 of file lua_terrainmap.cpp.

References starting_positions_, and map_location::valid().

Referenced by impl_slocs_set(), and special_locations().

◆ set_terrain()

void mapgen_gamemap::set_terrain ( const map_location loc,
const terrain_code terrain,
const terrain_type_data::merge_mode  mode 
)

Definition at line 145 of file lua_terrainmap.cpp.

References simplemerge(), t, and gui2::terrain.

Referenced by intf_set_terrain(), and operator[]().

◆ simplemerge()

void mapgen_gamemap::simplemerge ( terrain_code  old,
terrain_code t,
const terrain_type_data::merge_mode  mode 
)
static

◆ special_location()

map_location mapgen_gamemap::special_location ( const std::string &  id) const

Definition at line 181 of file lua_terrainmap.cpp.

References starting_positions_, map_location::x, and map_location::y.

Referenced by impl_slocs_get(), and special_locations().

◆ special_locations() [1/2]

starting_positions& mapgen_gamemap::special_locations ( )
inline

Definition at line 76 of file lua_terrainmap.hpp.

References starting_positions_.

◆ special_locations() [2/2]

const starting_positions& mapgen_gamemap::special_locations ( ) const
inline

◆ to_string()

std::string mapgen_gamemap::to_string ( ) const

Definition at line 140 of file lua_terrainmap.cpp.

References starting_positions_, tiles_, and t_translation::write_game_map().

Referenced by impl_terainmap_get().

◆ total_height()

int mapgen_gamemap::total_height ( ) const
inline

Real height of the map, including borders.

Definition at line 51 of file lua_terrainmap.hpp.

References t_translation::ter_map::h, and tiles_.

Referenced by for_each_loc(), h(), impl_terainmap_get(), on_map(), on_map_noborder(), and filter_impl::~filter_impl().

◆ total_width()

int mapgen_gamemap::total_width ( ) const
inline

Real width of the map, including borders.

Definition at line 48 of file lua_terrainmap.hpp.

References tiles_, and t_translation::ter_map::w.

Referenced by for_each_loc(), impl_terainmap_get(), on_map(), on_map_noborder(), w(), and filter_impl::~filter_impl().

◆ w()

int mapgen_gamemap::w ( ) const
inline

Effective map width.

Definition at line 42 of file lua_terrainmap.hpp.

References total_width().

Referenced by intf_terainmap_create().

Member Data Documentation

◆ starting_positions_

starting_positions mapgen_gamemap::starting_positions_
private

◆ tiles_

t_translation::ter_map mapgen_gamemap::tiles_
private

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