#include <mapgen_lua_kernel.hpp>
Public Member Functions | |
mapgen_lua_kernel () | |
virtual std::string | my_name () |
void | user_config (const char *prog, const config &generator) |
std::string | create_map (const char *prog, const config &generator, boost::optional< boost::uint32_t > seed) |
config | create_scenario (const char *prog, const config &generator, boost::optional< boost::uint32_t > seed) |
virtual boost::uint32_t | get_random_seed () |
boost::mt19937 & | get_default_rng () |
Public Member Functions inherited from lua_kernel_base | |
lua_kernel_base (CVideo *ptr) | |
virtual | ~lua_kernel_base () |
void | run_lua_tag (const config &cfg) |
Runs a [lua] tag. More... | |
void | run (char const *prog, int nArgs=0) |
Runs a plain script. More... | |
void | throwing_run (char const *prog, int nArgs) |
Runs a plain script, but reports errors by throwing lua_error. More... | |
void | interactive_run (char const *prog) |
Tests if a program resolves to an expression, and pretty prints it if it is, otherwise it runs it normally. More... | |
void | load_package () |
Loads the "package" package into the Lua environment. More... | |
std::vector< std::string > | get_global_var_names () |
Gets all the global variable names in the Lua environment. More... | |
std::vector< std::string > | get_attribute_names (const std::string &var_path) |
Gets all attribute names of an extended variable name. More... | |
const std::stringstream & | get_log () |
void | clear_log () |
void | set_external_log (std::ostream *lg) |
virtual void | log_error (char const *msg, char const *context="Lua error") |
virtual void | throw_exception (char const *msg, char const *context="Lua error") |
void | set_video (CVideo *ptr) |
lua_State * | get_state () |
Private Member Functions | |
void | run_generator (const char *prog, const config &generator) |
Private Attributes | |
boost::optional< boost::uint32_t > | random_seed_ |
boost::optional< boost::mt19937 > | default_rng_ |
Additional Inherited Members | |
Public Types inherited from lua_kernel_base | |
typedef std::function< void(char const *, char const *)> | error_handler |
Static Public Member Functions inherited from lua_kernel_base | |
template<typename T > | |
static T & | get_lua_kernel (lua_State *L) |
Protected Member Functions inherited from lua_kernel_base | |
int | intf_print (lua_State *L) |
Replacement print function – instead of printing to std::cout, print to the command log. More... | |
int | intf_show_dialog (lua_State *L) |
int | intf_show_message_dialog (lua_State *L) |
int | intf_show_popup_dialog (lua_State *L) |
int | intf_show_lua_console (lua_State *L) |
bool | protected_call (int nArgs, int nRets, error_handler) |
bool | load_string (char const *prog, error_handler) |
virtual bool | protected_call (int nArgs, int nRets) |
virtual bool | load_string (char const *prog) |
int | intf_dofile (lua_State *L) |
Loads and executes a Lua file. More... | |
int | intf_require (lua_State *L) |
Loads and executes a Lua file, if there is no corresponding entry in wesnoth.package. More... | |
Static Protected Member Functions inherited from lua_kernel_base | |
static bool | protected_call (lua_State *L, int nArgs, int nRets, error_handler) |
Protected Attributes inherited from lua_kernel_base | |
lua_State * | mState |
CVideo * | video_ |
command_log | cmd_log_ |
Definition at line 27 of file mapgen_lua_kernel.hpp.
mapgen_lua_kernel::mapgen_lua_kernel | ( | ) |
Definition at line 121 of file mapgen_lua_kernel.cpp.
References intf_find_path(), intf_random(), lua_getglobal(), lua_gettop(), lua_istable, lua_pop, lua_settop(), luaL_setfuncs(), and lua_kernel_base::mState.
std::string mapgen_lua_kernel::create_map | ( | const char * | prog, |
const config & | generator, | ||
boost::optional< boost::uint32_t > | seed | ||
) |
Definition at line 154 of file mapgen_lua_kernel.cpp.
References lua_error(), lua_isstring(), lua_pop, lua_tostring, lua_type(), lua_typename(), game_logic::msg(), lua_kernel_base::mState, random_seed_, and run_generator().
Referenced by lua_map_generator::create_map().
config mapgen_lua_kernel::create_scenario | ( | const char * | prog, |
const config & | generator, | ||
boost::optional< boost::uint32_t > | seed | ||
) |
Definition at line 169 of file mapgen_lua_kernel.cpp.
References lua_error(), lua_istable, lua_pop, lua_type(), lua_typename(), luaW_toconfig(), game_logic::msg(), lua_kernel_base::mState, random_seed_, and run_generator().
Referenced by lua_map_generator::create_scenario().
boost::mt19937 & mapgen_lua_kernel::get_default_rng | ( | ) |
Definition at line 198 of file mapgen_lua_kernel.cpp.
References default_rng_, and get_random_seed().
|
virtual |
Reimplemented from lua_kernel_base.
Definition at line 188 of file mapgen_lua_kernel.cpp.
References lua_kernel_base::get_random_seed(), and random_seed_.
Referenced by get_default_rng().
|
inlinevirtual |
Reimplemented from lua_kernel_base.
Definition at line 31 of file mapgen_lua_kernel.hpp.
Definition at line 142 of file mapgen_lua_kernel.cpp.
References lua_kernel_base::load_string(), luaW_pushconfig(), lua_kernel_base::mState, lua_kernel_base::protected_call(), and lua_kernel_base::throw_exception().
Referenced by create_map(), create_scenario(), and user_config().
Definition at line 149 of file mapgen_lua_kernel.cpp.
References run_generator().
Referenced by lua_map_generator::user_config().
|
private |
Definition at line 42 of file mapgen_lua_kernel.hpp.
Referenced by get_default_rng().
|
private |
Definition at line 41 of file mapgen_lua_kernel.hpp.
Referenced by create_map(), create_scenario(), and get_random_seed().