The Battle for Wesnoth  1.19.0-dev
Classes | Namespaces | Macros | Typedefs | Functions | Variables
lua_terrainfilter.cpp File Reference
#include "scripting/lua_terrainfilter.hpp"
#include "scripting/lua_terrainmap.hpp"
#include "formatter.hpp"
#include "global.hpp"
#include "log.hpp"
#include "map/location.hpp"
#include "map/map.hpp"
#include "pathutils_impl.hpp"
#include "scripting/lua_common.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>
Include dependency graph for lua_terrainfilter.cpp:

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 knows_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_locationluaW_to_locationset (lua_State *L, int index)
 
static int intf_mg_get_locations_part2 (lua_State *L, gamemap_base &m, lua_mapgen::filter &f)
 
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::filterluaW_to_mgfilter (lua_State *L, int index)
 
lua_mapgen::filterluaW_check_mgfilter (lua_State *L, int index)
 
void lua_mgfilter_setmetatable (lua_State *L)
 
template<typename... T>
static lua_mapgen::filterluaW_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"
 

Macro Definition Documentation

◆ ERR_LMG

#define ERR_LMG   LOG_STREAM(err, log_scripting_lua_mapgen)

Definition at line 36 of file lua_terrainfilter.cpp.

◆ LOG_LMG

#define LOG_LMG   LOG_STREAM(info, log_scripting_lua_mapgen)

Definition at line 35 of file lua_terrainfilter.cpp.

◆ LOG_MATCHES

#define LOG_MATCHES (   NAME)    LOG_LMG << #NAME << ":matches(" << l << ") line:" << __LINE__;

Definition at line 55 of file lua_terrainfilter.cpp.

Typedef Documentation

◆ dynamic_bitset

using dynamic_bitset = boost::dynamic_bitset<>

Definition at line 51 of file lua_terrainfilter.cpp.

◆ knows_sets_t

using knows_sets_t = std::map<std::string, std::set<map_location> >

Definition at line 48 of file lua_terrainfilter.cpp.

◆ location_set

using location_set = std::set<map_location>

Definition at line 52 of file lua_terrainfilter.cpp.

◆ offset_list_t

using offset_list_t = std::vector<std::pair<int, int> >

Definition at line 49 of file lua_terrainfilter.cpp.

Function Documentation

◆ impl_terrainfilter_collect()

static int impl_terrainfilter_collect ( lua_State *  L)
static

Destroys a map object before it is collected (__gc metamethod).

Definition at line 838 of file lua_terrainfilter.cpp.

References f, and luaW_check_mgfilter().

Referenced by lua_terrainfilter::register_metatables().

◆ impl_terrainfilter_get()

static int impl_terrainfilter_get ( lua_State *  L)
static

Gets some data on a filter (__index metamethod).

  • Arg 1: full userdata containing the filter.
  • Arg 2: string containing the name of the property.
  • Ret 1: something containing the attribute.

Definition at line 802 of file lua_terrainfilter.cpp.

References f, luaW_check_mgfilter(), and UNUSED.

Referenced by lua_terrainfilter::register_metatables().

◆ impl_terrainfilter_set()

static int impl_terrainfilter_set ( lua_State *  L)
static

Sets some data on a filter (__newindex metamethod).

  • Arg 1: full userdata containing the filter.
  • Arg 2: string containing the name of the property.
  • Arg 3: something containing the attribute.

Definition at line 815 of file lua_terrainfilter.cpp.

References f, luaW_check_mgfilter(), and UNUSED.

Referenced by lua_terrainfilter::register_metatables().

◆ intf_clearcache()

static int intf_clearcache ( lua_State *  L)
static

Clears the cache of a filter.

Definition at line 829 of file lua_terrainfilter.cpp.

References f, luaW_check_mgfilter(), and UNUSED.

Referenced by lua_terrainfilter::register_metatables().

◆ intf_mg_get_locations()

int intf_mg_get_locations ( lua_State *  L)

◆ intf_mg_get_locations_part2()

static int intf_mg_get_locations_part2 ( lua_State *  L,
gamemap_base m,
lua_mapgen::filter f 
)
static

◆ intf_mg_get_tiles_radius()

int intf_mg_get_tiles_radius ( lua_State *  L)

◆ intf_terrainfilter_create()

int intf_terrainfilter_create ( lua_State *  L)

Create a filter.

Definition at line 776 of file lua_terrainfilter.cpp.

References e, and luaW_push_mgfilter().

Referenced by mapgen_lua_kernel::mapgen_lua_kernel().

◆ lua_mgfilter_setmetatable()

void lua_mgfilter_setmetatable ( lua_State *  L)

Definition at line 759 of file lua_terrainfilter.cpp.

References terrinfilterKey.

Referenced by luaW_push_mgfilter().

◆ luaW_check_mgfilter()

lua_mapgen::filter& luaW_check_mgfilter ( lua_State *  L,
int  index 
)

◆ luaW_is_mgfilter()

bool luaW_is_mgfilter ( lua_State *  L,
int  index 
)

◆ luaW_push_mgfilter()

template<typename... T>
static lua_mapgen::filter* luaW_push_mgfilter ( lua_State *  L,
T &&...  params 
)
static

Definition at line 765 of file lua_terrainfilter.cpp.

References LOG_LMG, and lua_mgfilter_setmetatable().

Referenced by intf_terrainfilter_create().

◆ luaW_to_locationset()

static std::set<map_location> luaW_to_locationset ( lua_State *  L,
int  index 
)
static

◆ luaW_to_mgfilter()

lua_mapgen::filter* luaW_to_mgfilter ( lua_State *  L,
int  index 
)

Definition at line 742 of file lua_terrainfilter.cpp.

References utf8::index(), and luaW_is_mgfilter().

Variable Documentation

◆ log_scripting_lua_mapgen

lg::log_domain log_scripting_lua_mapgen("scripting/lua/mapgen") ( "scripting/lua/mapgen"  )
static

◆ terrinfilterKey

const char terrinfilterKey[] = "terrainfilter"
static