The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mapgen_lua_kernel.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2016 by Chris Beck <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #ifndef INCLUDED_MAPGEN_LUA_KERNEL
16 #define INCLUDED_MAPGEN_LUA_KERNEL
17 
19 #include <boost/optional.hpp>
20 #include <boost/cstdint.hpp>
21 #include <boost/random/mersenne_twister.hpp>
22 
23 class config;
24 
25 #include <string>
26 
28 public:
30 
31  virtual std::string my_name() { return "Mapgen Lua Kernel"; }
32 
33  void user_config(const char * prog, const config & generator); // throws game::lua_error
34  std::string create_map(const char * prog, const config & generator, boost::optional<boost::uint32_t> seed); // throws game::lua_error
35  config create_scenario(const char * prog, const config & generator, boost::optional<boost::uint32_t> seed); // throws game::lua_error
36 
38  boost::mt19937& get_default_rng();
39 private:
40  void run_generator(const char * prog, const config & generator);
41  boost::optional<boost::uint32_t> random_seed_;
42  boost::optional<boost::mt19937> default_rng_;
43 };
44 
45 #endif
boost::optional< boost::mt19937 > default_rng_
rng * generator
This generator is automatically synced during synced context.
Definition: random_new.cpp:52
boost::uint32_t uint32_t
Definition: xbrz.hpp:45
config create_scenario(const char *prog, const config &generator, boost::optional< boost::uint32_t > seed)
virtual boost::uint32_t get_random_seed()
void user_config(const char *prog, const config &generator)
virtual std::string my_name()
void run_generator(const char *prog, const config &generator)
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
GLsizei const GLcharARB ** string
Definition: glew.h:4503
boost::mt19937 & get_default_rng()
std::string create_map(const char *prog, const config &generator, boost::optional< boost::uint32_t > seed)
boost::optional< boost::uint32_t > random_seed_