#include "scripting/lua_terrainmap.hpp"
#include "log.hpp"
#include "map/location.hpp"
#include "map/map.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/push_check.hpp"
#include "resources.hpp"
#include "game_board.hpp"
#include "play_controller.hpp"
Go to the source code of this file.
Classes | |
struct | lua_map_ref |
Namespaces | |
replace_if_failed_idx | |
lua_terrainmap | |
Macros | |
#define | LOG_LUA LOG_STREAM(info, log_scripting_lua) |
#define | ERR_LUA LOG_STREAM(err, log_scripting_lua) |
Enumerations | |
enum | { replace_if_failed_idx::CODE = 1 , replace_if_failed_idx::MODE = 2 } |
Functions | |
static int | impl_slocs_get (lua_State *L) |
static int | impl_slocs_set (lua_State *L) |
static int | impl_slocs_next (lua_State *L) |
static int | impl_slocs_iter (lua_State *L) |
static void | simplemerge (t_translation::terrain_code old_t, t_translation::terrain_code &new_t, const terrain_type_data::merge_mode mode) |
bool | luaW_isterrainmap (lua_State *L, int index) |
gamemap_base * | luaW_toterrainmap (lua_State *L, int index) |
gamemap_base & | luaW_checkterrainmap (lua_State *L, int index) |
int | intf_terrainmap_create (lua_State *L) |
Create a map. More... | |
int | intf_terrainmap_get (lua_State *L) |
static int | impl_terrainmap_collect (lua_State *L) |
Destroys a map object before it is collected (__gc metamethod). More... | |
static void | luaW_push_terrain (lua_State *L, gamemap_base &map, map_location loc) |
static void | impl_merge_terrain (lua_State *L, gamemap_base &map, map_location loc) |
static int | impl_terrainmap_get (lua_State *L) |
Gets some data on a map (__index metamethod). More... | |
static int | impl_terrainmap_set (lua_State *L) |
Sets some data on a map (__newindex metamethod). More... | |
template<bool with_border> | |
static int | impl_terrainmap_iter (lua_State *L) |
int | intf_terrainmap_iter (lua_State *L) |
int | intf_on_board (lua_State *L) |
int | intf_on_border (lua_State *L) |
static std::vector< gamemap::overlay_rule > | read_rules_vector (lua_State *L, int index) |
int | intf_terrain_mask (lua_State *L) |
Replaces part of the map. More... | |
int | intf_replace_if_failed (lua_State *L) |
static int | impl_replace_if_failed_tostring (lua_State *L) |
std::string | lua_terrainmap::register_metatables (lua_State *L) |
Variables | |
static lg::log_domain | log_scripting_lua ("scripting/lua") |
static const char | terrainmapKey [] = "terrain map" |
static const char | maplocationKey [] = "special locations" |
static const char | mapReplaceIfFailedKey [] = "replace_if_failed terrain code" |
#define ERR_LUA LOG_STREAM(err, log_scripting_lua) |
Definition at line 29 of file lua_terrainmap.cpp.
#define LOG_LUA LOG_STREAM(info, log_scripting_lua) |
Definition at line 28 of file lua_terrainmap.cpp.
|
static |
Definition at line 234 of file lua_terrainmap.cpp.
References terrain_type_data::BASE, terrain_type_data::BOTH, game_board::change_terrain(), replace_if_failed_idx::CODE, resources::controller, resources::gameboard, play_controller::get_display(), mapReplaceIfFailedKey, replace_if_failed_idx::MODE, game_display::needs_rebuild(), terrain_type_data::OVERLAY, t_translation::read_terrain_code(), gamemap_base::set_terrain(), and t.
Referenced by impl_terrainmap_set().
|
static |
Definition at line 557 of file lua_terrainmap.cpp.
References replace_if_failed_idx::CODE, and replace_if_failed_idx::MODE.
Referenced by lua_terrainmap::register_metatables().
|
static |
Definition at line 43 of file lua_terrainmap.cpp.
References luaW_checkterrainmap(), luaW_pushlocation(), and gamemap_base::special_location().
Referenced by lua_terrainmap::register_metatables().
|
static |
Definition at line 91 of file lua_terrainmap.cpp.
References impl_slocs_next().
Referenced by lua_terrainmap::register_metatables().
|
static |
Definition at line 67 of file lua_terrainmap.cpp.
References luaW_checkterrainmap(), luaW_pushlocation(), and gamemap_base::special_locations().
Referenced by impl_slocs_iter().
|
static |
Definition at line 57 of file lua_terrainmap.cpp.
References luaW_checklocation(), luaW_checkterrainmap(), and gamemap_base::set_special_location().
Referenced by lua_terrainmap::register_metatables().
|
static |
Destroys a map object before it is collected (__gc metamethod).
Definition at line 221 of file lua_terrainmap.cpp.
Referenced by lua_terrainmap::register_metatables().
|
static |
Gets some data on a map (__index metamethod).
Definition at line 277 of file lua_terrainmap.cpp.
References gamemap_base::border_size(), gamemap_base::h(), luaW_checkterrainmap(), luaW_getglobal(), luaW_push_terrain(), luaW_tolocation(), maplocationKey, return_int_attrib, return_string_attrib, gamemap_base::to_string(), gamemap_base::total_height(), gamemap_base::total_width(), and gamemap_base::w().
Referenced by lua_terrainmap::register_metatables().
|
static |
Definition at line 353 of file lua_terrainmap.cpp.
References gamemap_base::h(), h, luaW_checklocation(), luaW_checkterrainmap(), luaW_push_terrain(), luaW_pushlocation(), gamemap_base::total_height(), gamemap_base::total_width(), w, gamemap_base::w(), map_location::wml_x(), and map_location::wml_y().
|
static |
Sets some data on a map (__newindex metamethod).
Definition at line 313 of file lua_terrainmap.cpp.
References impl_merge_terrain(), luaW_checkterrainmap(), and luaW_tolocation().
Referenced by lua_terrainmap::register_metatables().
int intf_on_board | ( | lua_State * | L | ) |
Definition at line 404 of file lua_terrainmap.cpp.
References luaW_checklocation(), luaW_checkterrainmap(), luaW_toboolean(), gamemap_base::on_board(), and gamemap_base::on_board_with_border().
Referenced by game_lua_kernel::game_lua_kernel().
int intf_on_border | ( | lua_State * | L | ) |
Definition at line 414 of file lua_terrainmap.cpp.
References luaW_checklocation(), luaW_checkterrainmap(), gamemap_base::on_board(), and gamemap_base::on_board_with_border().
Referenced by game_lua_kernel::game_lua_kernel().
int intf_replace_if_failed | ( | lua_State * | L | ) |
Definition at line 534 of file lua_terrainmap.cpp.
References terrain_type_data::BASE, terrain_type_data::BOTH, replace_if_failed_idx::CODE, mapReplaceIfFailedKey, replace_if_failed_idx::MODE, and terrain_type_data::OVERLAY.
Referenced by game_lua_kernel::game_lua_kernel().
int intf_terrain_mask | ( | lua_State * | L | ) |
Replaces part of the map.
Definition at line 481 of file lua_terrainmap.cpp.
References resources::controller, resources::gameboard, play_controller::get_display(), is_odd(), luaW_checklocation(), luaW_checkterrainmap(), luaW_table_get_def(), luaW_tableget(), game_display::needs_rebuild(), gamemap_base::overlay(), read_rules_vector(), and t.
Referenced by game_lua_kernel::game_lua_kernel().
int intf_terrainmap_create | ( | lua_State * | L | ) |
Create a map.
Definition at line 196 of file lua_terrainmap.cpp.
References h, t_translation::read_terrain_code(), terrainmapKey, and w.
Referenced by mapgen_lua_kernel::mapgen_lua_kernel().
int intf_terrainmap_get | ( | lua_State * | L | ) |
Definition at line 211 of file lua_terrainmap.cpp.
References resources::gameboard, and terrainmapKey.
int intf_terrainmap_iter | ( | lua_State * | L | ) |
Definition at line 389 of file lua_terrainmap.cpp.
References luaW_checkterrainmap(), luaW_pushlocation(), and luaW_toboolean().
Referenced by game_lua_kernel::game_lua_kernel().
gamemap_base& luaW_checkterrainmap | ( | lua_State * | L, |
int | index | ||
) |
Definition at line 179 of file lua_terrainmap.cpp.
References utf8::index(), luaW_isterrainmap(), and luaW_type_error().
Referenced by impl_slocs_get(), impl_slocs_next(), impl_slocs_set(), impl_terrainmap_get(), impl_terrainmap_iter(), impl_terrainmap_set(), intf_mg_get_locations(), intf_mg_get_tiles_radius(), intf_on_board(), intf_on_border(), intf_terrain_mask(), and intf_terrainmap_iter().
bool luaW_isterrainmap | ( | lua_State * | L, |
int | index | ||
) |
Definition at line 165 of file lua_terrainmap.cpp.
References utf8::index(), maplocationKey, and terrainmapKey.
Referenced by luaW_checkterrainmap(), and luaW_toterrainmap().
|
static |
Definition at line 228 of file lua_terrainmap.cpp.
References gamemap_base::get_terrain(), t, and t_translation::write_terrain_code().
Referenced by impl_terrainmap_get(), and impl_terrainmap_iter().
gamemap_base* luaW_toterrainmap | ( | lua_State * | L, |
int | index | ||
) |
Definition at line 171 of file lua_terrainmap.cpp.
References utf8::index(), and luaW_isterrainmap().
|
static |
Definition at line 423 of file lua_terrainmap.cpp.
References terrain_type_data::BASE, terrain_type_data::BOTH, i, utf8::index(), luaW_tableget(), luaW_toboolean(), luaW_tostring(), terrain_type_data::OVERLAY, and t_translation::read_list().
Referenced by intf_terrain_mask().
|
static |
Definition at line 122 of file lua_terrainmap.cpp.
References t_translation::terrain_code::base, terrain_type_data::BASE, terrain_type_data::BOTH, t_translation::terrain_code::overlay, and terrain_type_data::OVERLAY.
Referenced by mapgen_gamemap::set_terrain().
|
static |
|
static |
Definition at line 32 of file lua_terrainmap.cpp.
Referenced by impl_terrainmap_get(), luaW_isterrainmap(), and lua_terrainmap::register_metatables().
|
static |
Definition at line 33 of file lua_terrainmap.cpp.
Referenced by impl_merge_terrain(), intf_replace_if_failed(), and lua_terrainmap::register_metatables().
|
static |
Definition at line 31 of file lua_terrainmap.cpp.
Referenced by intf_terrainmap_create(), intf_terrainmap_get(), luaW_isterrainmap(), and lua_terrainmap::register_metatables().