The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | 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_api.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/lua_rng.hpp"
#include "scripting/lua_pathfind_cost_calculator.hpp"
#include <ostream>
#include <string>
#include "utils/functional.hpp"
#include "lua/lauxlib.h"
#include "lua/lua.h"
#include "scripting/push_check.hpp"
Include dependency graph for mapgen_lua_kernel.cpp:

Go to the source code of this file.

Macros

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

Functions

static int intf_random (lua_State *L)
 Returns a random numer, same interface as math.random. More...
 
static int intf_find_path (lua_State *L)
 Finds a path between two locations. More...
 

Variables

static lg::log_domain log_mapgen ("mapgen")
 

Macro Definition Documentation

#define DBG_NG   LOG_STREAM(debug, log_mapgen)

Definition at line 36 of file mapgen_lua_kernel.cpp.

#define ERR_NG   LOG_STREAM(err, log_mapgen)

Definition at line 34 of file mapgen_lua_kernel.cpp.

#define LOG_NG   LOG_STREAM(info, log_mapgen)

Definition at line 35 of file mapgen_lua_kernel.cpp.

Function Documentation

static int intf_find_path ( lua_State L)
static

Finds a path between two locations.

  • Args 1,2: source location.
  • Args 3,4: destination.
  • Arg 5: cost function
  • Args 6,7 size of map.
  • Arg 8 include border.
  • Ret 1: array of pairs containing path steps.
  • Ret 2: path cost.

Definition at line 83 of file mapgen_lua_kernel.cpp.

References pathfind::a_star_search(), i, lua_createtable(), lua_isboolean, lua_isfunction, lua_pushfstring(), lua_pushinteger(), lua_rawseti(), LUA_TFUNCTION, lua_typename(), luaL_argerror(), luaL_checkinteger(), luaL_typename, luaW_toboolean(), pathfind::plain_route::move_cost, game_logic::msg(), pathfind::plain_route::steps, map_location::x, and map_location::y.

Referenced by mapgen_lua_kernel::mapgen_lua_kernel().

static int intf_random ( lua_State L)
static

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

Definition at line 45 of file mapgen_lua_kernel.cpp.

References lua_isnoneornil, lua_isnumber(), lua_push(), and luaL_argerror().

Referenced by mapgen_lua_kernel::mapgen_lua_kernel().

Variable Documentation

lg::log_domain log_mapgen("mapgen")
static