-
-
Notifications
You must be signed in to change notification settings - Fork 988
/
map_generator.hpp
69 lines (55 loc) · 1.78 KB
/
map_generator.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
Copyright (C) 2003 - 2018 by David White <dave@whitevine.net>
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#pragma once
class config;
#include "exceptions.hpp"
#include "map/location.hpp"
#include "utils/optional_fwd.hpp"
#include <cstdint>
struct mapgen_exception : public game::error
{
mapgen_exception(const std::string& msg)
: game::error(msg)
{}
};
class map_generator
{
public:
virtual ~map_generator() {}
/**
* Returns true if the map generator has an interactive screen,
* which allows the user to modify how the generator behaves.
*/
virtual bool allow_user_config() const;
/**
* 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).
*/
virtual void user_config();
/**
* Returns a string identifying the generator by name.
* The name should not contain spaces.
*/
virtual std::string name() const = 0;
/**
* Return a friendly name for the generator
* used to differentiate between different configs of the same generator
*/
virtual std::string config_name() const = 0;
/**
* Creates a new map and returns it.
* args may contain arguments to the map generator.
*/
virtual std::string create_map(utils::optional<uint32_t> randomseed = {}) = 0;
virtual config create_scenario(utils::optional<uint32_t> randomseed = {});
};