The Battle for Wesnoth  1.19.0-dev
map_settings.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2024
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  *
55  * @param value string containing the village gold
56  * @param classification
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  *
66  * @param value string containing the village support
67  *
68  * @returns the village support
69  */
70  int get_village_support(const std::string& value);
71 
72  /**
73  * Gets the xp modifier.
74  * If no valid value supplied, it will return a default.
75  *
76  * @param value string containing the xp modifier
77  *
78  * @returns the xp modifier
79  */
80  int get_xp_modifier(const std::string& value);
81 
82 } // namespace settings
game_classification * classification
Definition: resources.cpp:34
Contains the general settings which have a default.
const int turns_min
minimum number of turns
int get_village_support(const std::string &value)
Gets the village unit level support.
int get_turns(const std::string &value)
Gets the number of turns.
const int turns_step
slider step size for turns
int get_xp_modifier(const std::string &value)
Gets the xp modifier.
const int turns_max
maximum number of turns
const int turns_default
default number of turns
int get_village_gold(const std::string &value, const game_classification *classification)
Gets the village gold.