The Battle for Wesnoth  1.17.0-dev
map_settings.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2021
3  by Mark de Wever <koraq@xs4all.nl>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 /**
17  * @file
18  * General settings and defaults for scenarios.
19  */
20 
21 #pragma once
22 
23 #include <string>
24 #include "game_classification.hpp"
25 
26 /**
27  * Contains the general settings which have a default.
28  * These values can be used to initialize the preferences,
29  * but also to set map values if these aren't defined.
30  */
31 
32 namespace settings {
33 
34  /**
35  * Gets the number of turns.
36  * If no valid value supplied, it will return a default.
37  * The value is also range checked.
38  * When out of bounds, it will be set to the nearest bound.
39  *
40  * @param value string containing the number of turns
41  *
42  * @returns the number of turns
43  */
44  int get_turns(const std::string& value);
45  const int turns_min = 1; /**< minimum number of turns */
46  const int turns_max = 100; /**< maximum number of turns */
47  const int turns_default = 100; /**< default number of turns */
48  const int turns_step = 1; /**< slider step size for turns */
49 
50  /**
51  * Gets the village gold.
52  * If no valid value supplied, it will return a default.
53  * The default is 1 for singleplayer, and 2 for multiplayer.
54  * The value is also range checked.
55  * When out of bounds, it will be set to the nearest bound.
56  *
57  * @param value string containing the village gold
58  * @param classification
59  *
60  * @returns the village gold
61  */
62  int get_village_gold(const std::string& value, const game_classification* classification = nullptr);
63 
64  /**
65  * Gets the village unit level support.
66  * If no valid value supplied, it will return a default.
67  * The value is also range checked.
68  * When out of bounds, it will be set to the nearest bound.
69  *
70  * @param value string containing the village support
71  *
72  * @returns the village support
73  */
74  int get_village_support(const std::string& value);
75 
76  /**
77  * Gets the xp modifier.
78  * If no valid value supplied, it will return a default.
79  * The value is also range checked.
80  * When out of bounds, it will be set to the nearest bound.
81  *
82  * @param value string containing the xp modifier
83  *
84  * @returns the xp modifier
85  */
86  int get_xp_modifier(const std::string& value);
87 
88 } // namespace settings
const int turns_max
maximum number of turns
game_classification * classification
Definition: resources.cpp:35
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.