The Battle for Wesnoth  1.15.2+dev
Public Member Functions | Private Attributes | List of all members
lua_map_generator Class Reference

#include <lua_map_generator.hpp>

Inheritance diagram for lua_map_generator:
Inheritance graph

Public Member Functions

 lua_map_generator (const config &cfg, const config *vars)
 
bool allow_user_config () const override
 Returns true if the map generator has an interactive screen, which allows the user to modify how the generator behaves. More...
 
std::string name () const override
 Returns a string identifying the generator by name. More...
 
std::string id () const
 
std::string config_name () const override
 Return a friendly name for the generator used to differentiate between different configs of the same generator. More...
 
virtual void user_config () override
 Display the interactive screen, which allows the user to modify how the generator behaves. More...
 
virtual std::string create_map (boost::optional< uint32_t > randomseed) override
 Creates a new map and returns it. More...
 
virtual config create_scenario (boost::optional< uint32_t > randomseed) override
 
- Public Member Functions inherited from map_generator
virtual ~map_generator ()
 

Private Attributes

std::string id_
 
std::string config_name_
 
std::string user_config_
 
std::string create_map_
 
std::string create_scenario_
 
mapgen_lua_kernel lk_
 
config generator_data_
 

Detailed Description

Definition at line 24 of file lua_map_generator.hpp.

Constructor & Destructor Documentation

◆ lua_map_generator()

lua_map_generator::lua_map_generator ( const config cfg,
const config vars 
)

Member Function Documentation

◆ allow_user_config()

bool lua_map_generator::allow_user_config ( ) const
inlineoverridevirtual

Returns true if the map generator has an interactive screen, which allows the user to modify how the generator behaves.

by default we don't allow user configs.

Reimplemented from map_generator.

Definition at line 28 of file lua_map_generator.hpp.

References user_config_.

◆ config_name()

std::string lua_map_generator::config_name ( ) const
inlineoverridevirtual

Return a friendly name for the generator used to differentiate between different configs of the same generator.

Implements map_generator.

Definition at line 34 of file lua_map_generator.hpp.

References config_name_, create_map(), create_scenario(), and user_config().

◆ create_map()

std::string lua_map_generator::create_map ( boost::optional< uint32_t >  randomseed)
overridevirtual

Creates a new map and returns it.

args may contain arguments to the map generator.

Implements map_generator.

Definition at line 61 of file lua_map_generator.cpp.

References config_name_, mapgen_lua_kernel::create_map(), map_generator::create_map(), create_map_, e, generator_data_, lk_, wfl::msg(), and game::error::what().

Referenced by config_name().

◆ create_scenario()

config lua_map_generator::create_scenario ( boost::optional< uint32_t >  randomseed)
overridevirtual

◆ id()

std::string lua_map_generator::id ( ) const
inline

Definition at line 32 of file lua_map_generator.hpp.

References id_.

◆ name()

std::string lua_map_generator::name ( ) const
inlineoverridevirtual

Returns a string identifying the generator by name.

The name should not contain spaces.

Implements map_generator.

Definition at line 30 of file lua_map_generator.hpp.

◆ user_config()

void lua_map_generator::user_config ( )
overridevirtual

Display the interactive screen, which allows the user to modify how the generator behaves.

(This function will not be called if allow_user_config() returns false).

Reimplemented from map_generator.

Definition at line 49 of file lua_map_generator.cpp.

References config_name_, e, generator_data_, lk_, wfl::msg(), mapgen_lua_kernel::user_config(), user_config_, and game::error::what().

Referenced by config_name().

Member Data Documentation

◆ config_name_

std::string lua_map_generator::config_name_
private

Definition at line 41 of file lua_map_generator.hpp.

Referenced by config_name(), create_map(), create_scenario(), and user_config().

◆ create_map_

std::string lua_map_generator::create_map_
private

Definition at line 44 of file lua_map_generator.hpp.

Referenced by create_map().

◆ create_scenario_

std::string lua_map_generator::create_scenario_
private

Definition at line 45 of file lua_map_generator.hpp.

Referenced by create_scenario().

◆ generator_data_

config lua_map_generator::generator_data_
private

Definition at line 49 of file lua_map_generator.hpp.

Referenced by create_map(), create_scenario(), and user_config().

◆ id_

std::string lua_map_generator::id_
private

Definition at line 41 of file lua_map_generator.hpp.

Referenced by id().

◆ lk_

mapgen_lua_kernel lua_map_generator::lk_
private

Definition at line 47 of file lua_map_generator.hpp.

Referenced by create_map(), create_scenario(), lua_map_generator(), and user_config().

◆ user_config_

std::string lua_map_generator::user_config_
private

Definition at line 43 of file lua_map_generator.hpp.

Referenced by allow_user_config(), and user_config().


The documentation for this class was generated from the following files: