The Battle for Wesnoth  1.19.9+dev
map_settings.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2025
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 
25 #include "game_classification.hpp"
28 
29 /**
30  * Contains the general settings which have a default.
31  * These values can be used to initialize the preferences,
32  * but also to set map values if these aren't defined.
33  */
34 
35 namespace settings {
36 
37  /**
38  * Gets the number of turns.
39  * If no valid value supplied, it will return a default.
40  * The value is also range checked.
41  * When out of bounds, it will be set to the nearest bound.
42  *
43  * @param value string containing the number of turns
44  *
45  * @returns the number of turns
46  */
47  int get_turns(const std::string& value);
48  const int turns_min = 1; /**< minimum number of turns */
49  const int turns_max = 100; /**< maximum number of turns */
50  const int turns_default = 100; /**< default number of turns */
51  const int turns_step = 1; /**< slider step size for turns */
52 
53  /**
54  * Gets the village gold.
55  * If no valid value supplied, it will return a default.
56  * The default is 1 for singleplayer, and 2 for multiplayer.
57  *
58  * @param value string containing the village gold
59  * @param classification
60  *
61  * @returns the village gold
62  */
63  int get_village_gold(const std::string& value, const game_classification* classification = nullptr);
64 
65  /**
66  * Gets the village unit level support.
67  * If no valid value supplied, it will return a default.
68  *
69  * @param value string containing the village support
70  *
71  * @returns the village support
72  */
73  int get_village_support(const std::string& value);
74 
75  /**
76  * Gets the xp modifier.
77  * If no valid value supplied, it will return a default.
78  *
79  * @param value string containing the xp modifier
80  *
81  * @returns the xp modifier
82  */
83  int get_xp_modifier(const std::string& value);
84 
85  //
86  // mp_parameter defaults
87  //
90 
91  std::string game_name_default();
96  std::chrono::seconds mp_countdown_init_time_default();
97  std::chrono::seconds mp_countdown_reservoir_time_default();
98  std::chrono::seconds mp_countdown_turn_bonus_default();
99  std::chrono::seconds mp_countdown_action_bonus_default();
100  bool mp_countdown_default();
103  bool fog_game_default(ng::create_engine& create);
106  bool shuffle_sides_default();
108 } // namespace settings
game_classification * classification
Definition: resources.cpp:34
Contains the general settings which have a default.
bool force_lock_settings(ng::create_engine &create)
random_faction_mode::type random_faction_mode_default()
bool shuffle_sides_default()
bool shroud_game_default(ng::create_engine &create)
int village_support_default(ng::create_engine &create)
std::chrono::seconds mp_countdown_action_bonus_default()
int village_gold_default(ng::create_engine &create)
const int turns_min
minimum number of turns
int get_village_support(const std::string &value)
Gets the village unit level support.
bool allow_observers_default()
int get_turns(const std::string &value)
Gets the number of turns.
std::chrono::seconds mp_countdown_reservoir_time_default()
std::chrono::seconds mp_countdown_turn_bonus_default()
int num_turns_default(ng::create_engine &create)
bool mp_countdown_default()
bool use_map_settings_default(ng::create_engine &create)
const int turns_step
slider step size for turns
std::string game_name_default()
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
std::chrono::seconds mp_countdown_init_time_default()
bool fog_game_default(ng::create_engine &create)
bool random_start_time_default(ng::create_engine &create)
int xp_modifier_default(ng::create_engine &create)
int get_village_gold(const std::string &value, const game_classification *classification)
Gets the village gold.
void set_default_values(ng::create_engine &create)