#include "scripting/lua_terrainfilter.hpp"
#include "scripting/lua_terrainmap.hpp"
#include "formatter.hpp"
#include "log.hpp"
#include "map/location.hpp"
#include "map/map.hpp"
#include "pathutils_impl.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/lua_formula_bridge.hpp"
#include "scripting/push_check.hpp"
#include "serialization/string_utils.hpp"
#include "formula/callable_objects.hpp"
#include "formula/formula.hpp"
#include <boost/dynamic_bitset.hpp>
#include <unordered_map>
Go to the source code of this file.
Classes | |
struct | invalid_lua_argument |
class | filter_impl |
Namespaces | |
lua_mapgen | |
lua_terrainfilter | |
Macros | |
#define | LOG_LMG LOG_STREAM(info, log_scripting_lua_mapgen) |
#define | ERR_LMG LOG_STREAM(err, log_scripting_lua_mapgen) |
#define | LOG_MATCHES(NAME) LOG_LMG << #NAME << ":matches(" << l << ") line:" << __LINE__; |
Typedefs | |
using | known_sets_t = std::map< std::string, std::set< map_location > > |
using | offset_list_t = std::vector< std::pair< int, int > > |
using | dynamic_bitset = boost::dynamic_bitset<> |
using | location_set = std::set< map_location > |
Functions | |
static std::set< map_location > | luaW_to_locationset (lua_State *L, int index) |
int | intf_mg_get_locations (lua_State *L) |
int | intf_mg_get_tiles_radius (lua_State *L) |
bool | luaW_is_mgfilter (lua_State *L, int index) |
lua_mapgen::filter * | luaW_to_mgfilter (lua_State *L, int index) |
lua_mapgen::filter_ptr | luaW_check_mgfilter (lua_State *L, int index, bool allow_compile) |
void | lua_mgfilter_setmetatable (lua_State *L) |
template<typename... T> | |
static lua_mapgen::filter * | luaW_push_mgfilter (lua_State *L, T &&... params) |
int | intf_terrainfilter_create (lua_State *L) |
Create a filter. More... | |
static int | impl_terrainfilter_get (lua_State *L) |
Gets some data on a filter (__index metamethod). More... | |
static int | impl_terrainfilter_set (lua_State *L) |
Sets some data on a filter (__newindex metamethod). More... | |
static int | intf_clearcache (lua_State *L) |
Clears the cache of a filter. More... | |
static int | impl_terrainfilter_collect (lua_State *L) |
Destroys a map object before it is collected (__gc metamethod). More... | |
std::string | lua_terrainfilter::register_metatables (lua_State *L) |
Variables | |
static lg::log_domain | log_scripting_lua_mapgen ("scripting/lua/mapgen") |
static const char | terrinfilterKey [] = "terrainfilter" |
#define ERR_LMG LOG_STREAM(err, log_scripting_lua_mapgen) |
Definition at line 36 of file lua_terrainfilter.cpp.
#define LOG_LMG LOG_STREAM(info, log_scripting_lua_mapgen) |
Definition at line 35 of file lua_terrainfilter.cpp.
#define LOG_MATCHES | ( | NAME | ) | LOG_LMG << #NAME << ":matches(" << l << ") line:" << __LINE__; |
Definition at line 55 of file lua_terrainfilter.cpp.
using dynamic_bitset = boost::dynamic_bitset<> |
Definition at line 51 of file lua_terrainfilter.cpp.
using known_sets_t = std::map<std::string, std::set<map_location> > |
Definition at line 48 of file lua_terrainfilter.cpp.
using location_set = std::set<map_location> |
Definition at line 52 of file lua_terrainfilter.cpp.
using offset_list_t = std::vector<std::pair<int, int> > |
Definition at line 49 of file lua_terrainfilter.cpp.
|
static |
Destroys a map object before it is collected (__gc metamethod).
Definition at line 869 of file lua_terrainfilter.cpp.
References f, and luaW_check_mgfilter().
Referenced by lua_terrainfilter::register_metatables().
|
static |
Gets some data on a filter (__index metamethod).
Definition at line 836 of file lua_terrainfilter.cpp.
References luaW_check_mgfilter().
Referenced by lua_terrainfilter::register_metatables().
|
static |
Sets some data on a filter (__newindex metamethod).
Definition at line 848 of file lua_terrainfilter.cpp.
References luaW_check_mgfilter().
Referenced by lua_terrainfilter::register_metatables().
|
static |
Clears the cache of a filter.
Definition at line 861 of file lua_terrainfilter.cpp.
References luaW_check_mgfilter().
Referenced by lua_terrainfilter::register_metatables().
int intf_mg_get_locations | ( | lua_State * | L | ) |
Definition at line 712 of file lua_terrainfilter.cpp.
References f, gamemap_base::for_each_loc(), LOG_LMG, luaW_check_mgfilter(), luaW_checkterrainmap(), luaW_push_locationset(), luaW_to_locationset(), and s.
Referenced by mapgen_lua_kernel::mapgen_lua_kernel().
int intf_mg_get_tiles_radius | ( | lua_State * | L | ) |
Definition at line 744 of file lua_terrainfilter.cpp.
References f, get_tiles_radius(), luaW_check_mgfilter(), luaW_checkterrainmap(), luaW_push_locationset(), luaW_to_locationset(), gamemap_base::on_board_with_border(), and s.
Referenced by mapgen_lua_kernel::mapgen_lua_kernel().
int intf_terrainfilter_create | ( | lua_State * | L | ) |
Create a filter.
Definition at line 810 of file lua_terrainfilter.cpp.
References e, and luaW_push_mgfilter().
Referenced by mapgen_lua_kernel::mapgen_lua_kernel().
void lua_mgfilter_setmetatable | ( | lua_State * | L | ) |
Definition at line 793 of file lua_terrainfilter.cpp.
References terrinfilterKey.
Referenced by luaW_push_mgfilter().
lua_mapgen::filter_ptr luaW_check_mgfilter | ( | lua_State * | L, |
int | index, | ||
bool | allow_compile | ||
) |
Definition at line 777 of file lua_terrainfilter.cpp.
References f, utf8::index(), luaW_is_mgfilter(), and luaW_type_error().
Referenced by impl_terrainfilter_collect(), impl_terrainfilter_get(), impl_terrainfilter_set(), intf_clearcache(), intf_mg_get_locations(), and intf_mg_get_tiles_radius().
bool luaW_is_mgfilter | ( | lua_State * | L, |
int | index | ||
) |
Definition at line 763 of file lua_terrainfilter.cpp.
References utf8::index(), and terrinfilterKey.
Referenced by luaW_check_mgfilter(), and luaW_to_mgfilter().
|
static |
Definition at line 799 of file lua_terrainfilter.cpp.
References LOG_LMG, and lua_mgfilter_setmetatable().
Referenced by intf_terrainfilter_create().
|
static |
Definition at line 161 of file lua_terrainfilter.cpp.
References i, utf8::index(), luaW_checklocation(), and luaW_tolocation().
Referenced by intf_mg_get_locations(), and intf_mg_get_tiles_radius().
lua_mapgen::filter* luaW_to_mgfilter | ( | lua_State * | L, |
int | index | ||
) |
Definition at line 769 of file lua_terrainfilter.cpp.
References utf8::index(), and luaW_is_mgfilter().
|
static |
|
static |
Definition at line 54 of file lua_terrainfilter.cpp.
Referenced by lua_mgfilter_setmetatable(), luaW_is_mgfilter(), and lua_terrainfilter::register_metatables().