The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
map_generator.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2017 by David White <dave@whitevine.net>
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 /** @file */
16 
17 #pragma once
18 
19 class config;
20 
21 #include "exceptions.hpp"
22 #include "map/location.hpp"
23 
24 #include <boost/optional.hpp>
25 #include <cstdint>
26 
28 {
30  : game::error(msg)
31  {}
32 };
33 
35 {
36 public:
37  virtual ~map_generator() {}
38 
39  /**
40  * Returns true if the map generator has an interactive screen,
41  * which allows the user to modify how the generator behaves.
42  */
43  virtual bool allow_user_config() const;
44 
45  /**
46  * Display the interactive screen, which allows the user
47  * to modify how the generator behaves.
48  * (This function will not be called if allow_user_config() returns false).
49  */
50  virtual void user_config();
51 
52  /**
53  * Returns a string identifying the generator by name.
54  * The name should not contain spaces.
55  */
56  virtual std::string name() const = 0;
57 
58  /**
59  * Return a friendly name for the generator
60  * used to differentiate between different configs of the same generator
61  */
62  virtual std::string config_name() const = 0;
63 
64  /**
65  * Creates a new map and returns it.
66  * args may contain arguments to the map generator.
67  */
68  virtual std::string create_map(boost::optional<uint32_t> randomseed = boost::none) = 0;
69 
70  virtual config create_scenario(boost::optional<uint32_t> randomseed = boost::none);
71 };
virtual bool allow_user_config() const
Returns true if the map generator has an interactive screen, which allows the user to modify how the ...
std::vector< char_t > string
virtual config create_scenario(boost::optional< uint32_t > randomseed=boost::none)
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:110
mapgen_exception(const std::string &msg)
virtual ~map_generator()
virtual void user_config()
Display the interactive screen, which allows the user to modify how the generator behaves...
virtual std::string create_map(boost::optional< uint32_t > randomseed=boost::none)=0
Creates a new map and returns it.
Base class for all the errors encountered by the engine.
Definition: exceptions.hpp:29
virtual std::string name() const =0
Returns a string identifying the generator by name.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:93
virtual std::string config_name() const =0
Return a friendly name for the generator used to differentiate between different configs of the same ...