The Battle for Wesnoth  1.17.4+dev
Macros | Typedefs | Functions | Variables
mapgen_lua_kernel.cpp File Reference
#include "scripting/mapgen_lua_kernel.hpp"
#include "config.hpp"
#include "game_errors.hpp"
#include "log.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/lua_rng.hpp"
#include "scripting/lua_pathfind_cost_calculator.hpp"
#include "scripting/lua_terrainfilter.hpp"
#include "scripting/lua_terrainmap.hpp"
#include "deprecation.hpp"
#include "game_version.hpp"
#include <ostream>
#include <string>
#include <functional>
#include "lua/lauxlib.h"
#include "scripting/push_check.hpp"
#include "generators/default_map_generator_job.hpp"
Include dependency graph for mapgen_lua_kernel.cpp:

Go to the source code of this file.


#define ERR_NG   LOG_STREAM(err, log_mapgen)
#define LOG_NG   LOG_STREAM(info, log_mapgen)
#define DBG_NG   LOG_STREAM(debug, log_mapgen)


typedef int(mapgen_lua_kernel::* member_callback) (lua_State *)


template<member_callback method>
int dispatch (lua_State *L)
static int intf_random (lua_State *L)
 Returns a random number, same interface as math.random. More...
static int intf_default_generate (lua_State *L)
 calls the default mapgenerator. More...
static int intf_default_generate_height_map (lua_State *L)
 calls the default mapgenerator. More...
static int intf_find_path (lua_State *L)
 Finds a path between two locations. More...


static lg::log_domain log_mapgen ("mapgen")

Macro Definition Documentation


#define DBG_NG   LOG_STREAM(debug, log_mapgen)

Definition at line 40 of file mapgen_lua_kernel.cpp.


#define ERR_NG   LOG_STREAM(err, log_mapgen)

Definition at line 38 of file mapgen_lua_kernel.cpp.


#define LOG_NG   LOG_STREAM(info, log_mapgen)

Definition at line 39 of file mapgen_lua_kernel.cpp.

Typedef Documentation

◆ member_callback

typedef int(mapgen_lua_kernel::* member_callback) (lua_State *)

Definition at line 46 of file mapgen_lua_kernel.cpp.

Function Documentation

◆ dispatch()

template<member_callback method>
int dispatch ( lua_State *  L)

Definition at line 49 of file mapgen_lua_kernel.cpp.

◆ intf_default_generate()

static int intf_default_generate ( lua_State *  L)

◆ intf_default_generate_height_map()

static int intf_default_generate_height_map ( lua_State *  L)

◆ intf_find_path()

static int intf_find_path ( lua_State *  L)

Finds a path between two locations.

  • Args 1: source location.
  • Args 2: destination.
  • Arg 3: cost function
  • Args 4,5 size of map.
  • Arg 6 include border. OR
  • Arg 3: options table containing calculate, width, height, (optional) include_borders
  • Ret 1: array of pairs containing path steps.
  • Ret 2: path cost.

Definition at line 183 of file mapgen_lua_kernel.cpp.

References pathfind::a_star_search(), i, luaW_checklocation(), luaW_tableget(), luaW_toboolean(), pathfind::plain_route::move_cost, wfl::msg(), and pathfind::plain_route::steps.

Referenced by mapgen_lua_kernel::mapgen_lua_kernel().

◆ intf_random()

static int intf_random ( lua_State *  L)

Returns a random number, same interface as math.random.

Definition at line 56 of file mapgen_lua_kernel.cpp.

References lua_push().

Referenced by mapgen_lua_kernel::mapgen_lua_kernel().

Variable Documentation

◆ log_mapgen

lg::log_domain log_mapgen("mapgen")