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 class CVideo;
21 
22 #include "exceptions.hpp"
23 #include "map/location.hpp"
24 
25 #include <boost/optional.hpp>
26 #include <cstdint>
27 
29 {
31  : game::error(msg)
32  {}
33 };
34 
36 {
37 public:
38  virtual ~map_generator() {}
39 
40  /**
41  * Returns true if the map generator has an interactive screen,
42  * which allows the user to modify how the generator behaves.
43  */
44  virtual bool allow_user_config() const;
45 
46  /**
47  * Display the interactive screen, which allows the user
48  * to modify how the generator behaves.
49  * (This function will not be called if allow_user_config() returns false).
50  */
51  virtual void user_config();
52 
53  /**
54  * Returns a string identifying the generator by name.
55  * The name should not contain spaces.
56  */
57  virtual std::string name() const = 0;
58 
59  /**
60  * Return a friendly name for the generator
61  * used to differentiate between different configs of the same generator
62  */
63  virtual std::string config_name() const = 0;
64 
65  /**
66  * Creates a new map and returns it.
67  * args may contain arguments to the map generator.
68  */
69  virtual std::string create_map(boost::optional<uint32_t> randomseed = boost::none) = 0;
70 
71  virtual config create_scenario(boost::optional<uint32_t> randomseed = boost::none);
72 };
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
Definition: video.hpp:29
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 ...