The Battle for Wesnoth  1.19.0-dev
Functions | Variables
settings Namespace Reference

Contains the general settings which have a default. More...

Functions

int get_turns (const std::string &value)
 Gets the number of turns. More...
 
int get_village_gold (const std::string &value, const game_classification *classification=nullptr)
 Gets the village gold. More...
 
int get_village_support (const std::string &value)
 Gets the village unit level support. More...
 
int get_xp_modifier (const std::string &value)
 Gets the xp modifier. More...
 

Variables

const int turns_min = 1
 minimum number of turns More...
 
const int turns_max = 100
 maximum number of turns More...
 
const int turns_default = 100
 default number of turns More...
 
const int turns_step = 1
 slider step size for turns More...
 

Detailed Description

Contains the general settings which have a default.

These values can be used to initialize the preferences, but also to set map values if these aren't defined.

Function Documentation

◆ get_turns()

int settings::get_turns ( const std::string &  value)

Gets the number of turns.

If no valid value supplied, it will return a default. The value is also range checked. When out of bounds, it will be set to the nearest bound.

Parameters
valuestring containing the number of turns
Returns
the number of turns

Definition at line 28 of file map_settings.cpp.

References turns_default, turns_max, and turns_min.

Referenced by ng::configure_engine::num_turns_default(), mp::start_local_game_commandline(), and preferences::turns().

◆ get_village_gold()

int settings::get_village_gold ( const std::string &  value,
const game_classification classification = nullptr 
)

Gets the village gold.

If no valid value supplied, it will return a default. The default is 1 for singleplayer, and 2 for multiplayer.

Parameters
valuestring containing the village gold
classification
Returns
the village gold

Definition at line 40 of file map_settings.cpp.

References resources::classification, and game_classification::is_normal_mp_game().

Referenced by mp::start_local_game_commandline(), preferences::village_gold(), and ng::configure_engine::village_gold_default().

◆ get_village_support()

int settings::get_village_support ( const std::string &  value)

Gets the village unit level support.

If no valid value supplied, it will return a default.

Parameters
valuestring containing the village support
Returns
the village support

Definition at line 45 of file map_settings.cpp.

Referenced by mp::start_local_game_commandline(), preferences::village_support(), and ng::configure_engine::village_support_default().

◆ get_xp_modifier()

int settings::get_xp_modifier ( const std::string &  value)

Gets the xp modifier.

If no valid value supplied, it will return a default.

Parameters
valuestring containing the xp modifier
Returns
the xp modifier

Definition at line 50 of file map_settings.cpp.

Referenced by mp::start_local_game_commandline(), preferences::xp_modifier(), and ng::configure_engine::xp_modifier_default().

Variable Documentation

◆ turns_default

const int settings::turns_default = 100

default number of turns

Definition at line 47 of file map_settings.hpp.

Referenced by get_turns().

◆ turns_max

const int settings::turns_max = 100

maximum number of turns

Definition at line 46 of file map_settings.hpp.

Referenced by get_turns(), and gui2::dialogs::mp_create_game::post_show().

◆ turns_min

const int settings::turns_min = 1

minimum number of turns

Definition at line 45 of file map_settings.hpp.

Referenced by get_turns().

◆ turns_step

const int settings::turns_step = 1

slider step size for turns

Definition at line 48 of file map_settings.hpp.