The Battle for Wesnoth  1.15.1+dev
map_settings.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2018 by Mark de Wever <koraq@xs4all.nl>
3  Part of the Battle for Wesnoth Project https://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 /**
16  * @file
17  * General settings and defaults for scenarios.
18  */
19 
20 #pragma once
21 
22 #include <string>
23 #include "game_classification.hpp"
24 
25 /**
26  * Contains the general settings which have a default.
27  * These values can be used to initialize the preferences,
28  * but also to set map values if these aren't defined.
29  */
30 
31 namespace settings {
32 
33  /**
34  * Gets the number of turns.
35  * If no valid value supplied, it will return a default.
36  * The value is also range checked.
37  * When out of bounds, it will be set to the nearest bound.
38  *
39  * @param value string containing the number of turns
40  *
41  * @returns the number of turns
42  */
43  int get_turns(const std::string& value);
44  const int turns_min = 1; /**< minimum number of turns */
45  const int turns_max = 100; /**< maximum number of turns */
46  const int turns_default = 100; /**< default number of turns */
47  const int turns_step = 1; /**< slider step size for turns */
48 
49  /**
50  * Gets the village gold.
51  * If no valid value supplied, it will return a default.
52  * The default is 1 for singleplayer, and 2 for multiplayer.
53  * The value is also range checked.
54  * When out of bounds, it will be set to the nearest bound.
55  *
56  * @param value string containing the village gold
57  *
58  * @returns the village gold
59  */
60  int get_village_gold(const std::string& value, const game_classification* classification = nullptr);
61 
62  /**
63  * Gets the village unit level support.
64  * If no valid value supplied, it will return a default.
65  * The value is also range checked.
66  * When out of bounds, it will be set to the nearest bound.
67  *
68  * @param value string containing the village support
69  *
70  * @returns the village support
71  */
72  int get_village_support(const std::string& value);
73 
74  /**
75  * Gets the xp modifier.
76  * If no valid value supplied, it will return a default.
77  * The value is also range checked.
78  * When out of bounds, it will be set to the nearest bound.
79  *
80  * @param value string containing the xp modifier
81  *
82  * @returns the xp modifier
83  */
84  int get_xp_modifier(const std::string& value);
85 
86 } // namespace settings
const int turns_max
maximum number of turns
game_classification * classification
Definition: resources.cpp:34
int get_village_gold(const std::string &value, const game_classification *classification)
Gets the village gold.
const int turns_default
default number of turns
const int turns_step
slider step size for turns
int get_village_support(const std::string &value)
Gets the village unit level support.
Contains the general settings which have a default.
int get_xp_modifier(const std::string &value)
Gets the xp modifier.
const int turns_min
minimum number of turns
int get_turns(const std::string &value)
Gets the number of turns.