27 #define ERR_NG LOG_STREAM(err, log_mapgen)
28 #define LOG_NG LOG_STREAM(info, log_mapgen)
32 , config_name_(cfg[
"config_name"])
33 , user_config_(cfg[
"user_config"])
34 , create_map_(cfg[
"create_map"])
35 , create_scenario_(cfg[
"create_scenario"])
37 , generator_data_(cfg)
40 using namespace std::string_literals;
41 const std::array required {
"id"s,
"config_name"s,
"create_map"s};
42 for(
const auto& req : required) {
44 if(req ==
"create_map" && cfg.
has_attribute(
"create_scenario")) {
48 std::string
msg =
"Error when constructing a lua map generator -- missing a required attribute '";
50 msg +=
"Config was '" + cfg.
debug() +
"'";
61 std::string
msg =
"Error when running lua_map_generator user_config.\n";
77 std::string
msg =
"Error when running lua_map_generator create_map.\n";
93 std::string
msg =
"Error when running lua_map_generator create_scenario.\n";
A config object defines a single node in a WML file, with access to child nodes.
bool has_attribute(config_key_type key) const
std::string debug() const
void load_core()
Loads the "core" library into the Lua environment.
std::string create_scenario_
lua_map_generator(const config &cfg, const config *vars)
virtual void user_config() override
Display the interactive screen, which allows the user to modify how the generator behaves.
virtual std::string create_map(utils::optional< uint32_t > randomseed) override
Creates a new map and returns it.
virtual config create_scenario(utils::optional< uint32_t > randomseed) override
virtual config create_scenario(utils::optional< uint32_t > randomseed={})
virtual std::string create_map(utils::optional< uint32_t > randomseed={})=0
Creates a new map and returns it.
void user_config(const char *prog, const config &generator)
std::string create_map(const char *prog, const config &generator, utils::optional< uint32_t > seed)
config create_scenario(const char *prog, const config &generator, utils::optional< uint32_t > seed)
Definitions for the interface to Wesnoth Markup Language (WML).
Standard logging facilities (interface).
static lg::log_domain log_mapgen("mapgen")
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Error used to report an error in a lua script or in the lua interpreter.
static map_location::direction s