The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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

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 29 of file settings.cpp.

References turns_default, turns_max, and turns_min.

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

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. The value is also range checked. When out of bounds, it will be set to the nearest bound.

Parameters
valuestring containing the village gold
Returns
the village gold

Definition at line 42 of file settings.cpp.

References game_classification::is_normal_mp_game().

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

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. The value is also range checked. When out of bounds, it will be set to the nearest bound.

Parameters
valuestring containing the village support
Returns
the village support

Definition at line 47 of file settings.cpp.

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

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

Gets the xp modifier.

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 xp modifier
Returns
the xp modifier

Definition at line 52 of file settings.cpp.

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

Variable Documentation

const int settings::turns_default = 100

default number of turns

Definition at line 47 of file settings.hpp.

Referenced by get_turns().

const int settings::turns_max = 100

maximum number of turns

Definition at line 46 of file settings.hpp.

Referenced by mp::configure::configure(), and get_turns().

const int settings::turns_min = 1

minimum number of turns

Definition at line 45 of file settings.hpp.

Referenced by mp::configure::configure(), and get_turns().

const int settings::turns_step = 1

slider step size for turns

Definition at line 48 of file settings.hpp.

Referenced by mp::configure::configure().