The Battle for Wesnoth  1.13.4+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 - 2016 by David White <[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 /** @file */
16 
17 #ifndef MAP_GEN_HPP_INCLUDED
18 #define MAP_GEN_HPP_INCLUDED
19 
20 class config;
21 class CVideo;
22 
23 #include "exceptions.hpp"
24 #include "map/location.hpp"
25 
26 #include <boost/optional.hpp>
27 #include <boost/cstdint.hpp>
28 
30 {
32  : game::error(msg)
33  {}
34 };
35 
37 {
38 public:
39  virtual ~map_generator() {}
40 
41  /**
42  * Returns true if the map generator has an interactive screen,
43  * which allows the user to modify how the generator behaves.
44  */
45  virtual bool allow_user_config() const;
46 
47  /**
48  * Display the interactive screen, which allows the user
49  * to modify how the generator behaves.
50  * (This function will not be called if allow_user_config() returns false).
51  */
52  virtual void user_config(CVideo& v);
53 
54  /**
55  * Returns a string identifying the generator by name.
56  * The name should not contain spaces.
57  */
58  virtual std::string name() const = 0;
59 
60  /**
61  * Return a friendly name for the generator
62  * used to differentiate between different configs of the same generator
63  */
64  virtual std::string config_name() const = 0;
65 
66  /**
67  * Creates a new map and returns it.
68  * args may contain arguments to the map generator.
69  */
70  virtual std::string create_map(boost::optional<boost::uint32_t> randomseed = boost::none) = 0;
71 
72  virtual config create_scenario(boost::optional<boost::uint32_t> randomseed = boost::none);
73 };
74 
75 #endif
virtual bool allow_user_config() const
Returns true if the map generator has an interactive screen, which allows the user to modify how the ...
Definition: video.hpp:58
virtual config create_scenario(boost::optional< boost::uint32_t > randomseed=boost::none)
mapgen_exception(const std::string &msg)
const GLdouble * v
Definition: glew.h:1359
virtual std::string create_map(boost::optional< boost::uint32_t > randomseed=boost::none)=0
Creates a new map and returns it.
virtual ~map_generator()
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:112
Base class for all the errors encountered by the engine.
Definition: exceptions.hpp:27
virtual std::string name() const =0
Returns a string identifying the generator by name.
virtual void user_config(CVideo &v)
Display the interactive screen, which allows the user to modify how the generator behaves...
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
virtual std::string config_name() const =0
Return a friendly name for the generator used to differentiate between different configs of the same ...
GLsizei const GLcharARB ** string
Definition: glew.h:4503