The Battle for Wesnoth  1.15.0-dev
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ng::configure_engine Class Reference

configure_engine More...

#include <configure_engine.hpp>

Public Member Functions

 configure_engine (saved_game &state, const config *initial=nullptr)
 
void set_default_values ()
 Set all parameters to their default values. More...
 
bool force_lock_settings () const
 Checks force_lock_settings in config. More...
 
std::string game_name () const
 
int num_turns () const
 
int village_gold () const
 
int village_support () const
 
int xp_modifier () const
 
int mp_countdown_init_time () const
 
int mp_countdown_reservoir_time () const
 
int mp_countdown_turn_bonus () const
 
int mp_countdown_action_bonus () const
 
bool mp_countdown () const
 
bool use_map_settings () const
 
bool random_start_time () const
 
bool fog_game () const
 
bool shroud_game () const
 
bool allow_observers () const
 
bool registered_users_only () const
 
bool shuffle_sides () const
 
mp_game_settings::RANDOM_FACTION_MODE random_faction_mode () const
 
const configoptions () const
 
void set_game_name (std::string name)
 
void set_game_password (std::string name)
 
void set_num_turns (int val)
 
void set_village_gold (int val)
 
void set_village_support (int val)
 
void set_xp_modifier (int val)
 
void set_mp_countdown_init_time (int val)
 
void set_mp_countdown_reservoir_time (int val)
 
void set_mp_countdown_turn_bonus (int val)
 
void set_mp_countdown_action_bonus (int val)
 
void set_mp_countdown (bool val)
 
void set_use_map_settings (bool val)
 
void set_random_start_time (bool val)
 
void set_fog_game (bool val)
 
void set_shroud_game (bool val)
 
void set_allow_observers (bool val)
 
void set_registered_users_only (bool val)
 
void set_oos_debug (bool val)
 
void set_shuffle_sides (bool val)
 
void set_random_faction_mode (mp_game_settings::RANDOM_FACTION_MODE val)
 
void set_options (const config &cfg)
 
int num_turns_default () const
 
int village_gold_default () const
 
int village_support_default () const
 
int xp_modifier_default () const
 
int mp_countdown_init_time_default () const
 
int mp_countdown_reservoir_time_default () const
 
int mp_countdown_turn_bonus_default () const
 
int mp_countdown_action_bonus_default () const
 
bool mp_countdown_default () const
 
bool use_map_settings_default () const
 
bool random_start_time_default () const
 
bool fog_game_default () const
 
bool shroud_game_default () const
 
bool allow_observers_default () const
 
bool registered_users_only_default () const
 
bool shuffle_sides_default () const
 
mp_game_settings::RANDOM_FACTION_MODE random_faction_mode_default () const
 
const configoptions_default () const
 
const mp_game_settingsget_parameters () const
 
void write_parameters ()
 
void update_initial_cfg (const config &cfg)
 

Static Public Member Functions

static std::string game_name_default ()
 

Private Member Functions

const configside_cfg () const
 Village gold, village support, fog, and shroud are per player but always show the player 1's values. More...
 
const configinitial_cfg () const
 

Private Attributes

saved_gamestate_
 
mp_game_settingsparameters_
 
const configinitial_
 Never nullptr. More...
 

Detailed Description

configure_engine

this class wraps the parameters relevant to mp_configure, as well as providing defaults for these parameters.

Definition at line 29 of file configure_engine.hpp.

Constructor & Destructor Documentation

◆ configure_engine()

ng::configure_engine::configure_engine ( saved_game state,
const config initial = nullptr 
)

Definition at line 30 of file configure_engine.cpp.

References set_use_map_settings(), and use_map_settings_default().

Member Function Documentation

◆ allow_observers()

bool ng::configure_engine::allow_observers ( ) const
inline

Definition at line 114 of file configure_engine.hpp.

References mp_game_settings::allow_observers, and parameters_.

◆ allow_observers_default()

bool ng::configure_engine::allow_observers_default ( ) const

Definition at line 143 of file configure_engine.cpp.

References preferences::allow_observers().

Referenced by set_random_faction_mode().

◆ fog_game()

bool ng::configure_engine::fog_game ( ) const
inline

Definition at line 104 of file configure_engine.hpp.

References mp_game_settings::fog_game, and parameters_.

◆ fog_game_default()

bool ng::configure_engine::fog_game_default ( ) const

◆ force_lock_settings()

bool ng::configure_engine::force_lock_settings ( ) const

Checks force_lock_settings in config.

Definition at line 56 of file configure_engine.cpp.

References saved_game::classification(), initial_cfg(), game_classification::is_normal_mp_game(), and state_.

Referenced by use_map_settings_default().

◆ game_name()

std::string ng::configure_engine::game_name ( ) const
inline

Definition at line 44 of file configure_engine.hpp.

References mp_game_settings::name, and parameters_.

◆ game_name_default()

std::string ng::configure_engine::game_name_default ( )
static

◆ get_parameters()

const mp_game_settings& ng::configure_engine::get_parameters ( ) const
inline

Definition at line 269 of file configure_engine.hpp.

References parameters_, and write_parameters().

◆ initial_cfg()

const config& ng::configure_engine::initial_cfg ( ) const
inlineprivate

◆ mp_countdown()

bool ng::configure_engine::mp_countdown ( ) const
inline

Definition at line 89 of file configure_engine.hpp.

References mp_game_settings::mp_countdown, and parameters_.

◆ mp_countdown_action_bonus()

int ng::configure_engine::mp_countdown_action_bonus ( ) const
inline

◆ mp_countdown_action_bonus_default()

int ng::configure_engine::mp_countdown_action_bonus_default ( ) const

◆ mp_countdown_default()

bool ng::configure_engine::mp_countdown_default ( ) const

Definition at line 114 of file configure_engine.cpp.

References preferences::countdown().

Referenced by set_default_values(), and set_random_faction_mode().

◆ mp_countdown_init_time()

int ng::configure_engine::mp_countdown_init_time ( ) const
inline

Definition at line 69 of file configure_engine.hpp.

References mp_game_settings::mp_countdown_init_time, and parameters_.

◆ mp_countdown_init_time_default()

int ng::configure_engine::mp_countdown_init_time_default ( ) const

◆ mp_countdown_reservoir_time()

int ng::configure_engine::mp_countdown_reservoir_time ( ) const
inline

◆ mp_countdown_reservoir_time_default()

int ng::configure_engine::mp_countdown_reservoir_time_default ( ) const

◆ mp_countdown_turn_bonus()

int ng::configure_engine::mp_countdown_turn_bonus ( ) const
inline

Definition at line 79 of file configure_engine.hpp.

References mp_game_settings::mp_countdown_turn_bonus, and parameters_.

◆ mp_countdown_turn_bonus_default()

int ng::configure_engine::mp_countdown_turn_bonus_default ( ) const

Definition at line 104 of file configure_engine.cpp.

References preferences::countdown_turn_bonus().

Referenced by set_random_faction_mode().

◆ num_turns()

int ng::configure_engine::num_turns ( ) const
inline

Definition at line 49 of file configure_engine.hpp.

References mp_game_settings::num_turns, and parameters_.

◆ num_turns_default()

int ng::configure_engine::num_turns_default ( ) const

◆ options()

const config& ng::configure_engine::options ( ) const
inline

Definition at line 134 of file configure_engine.hpp.

References mp_game_settings::options, and parameters_.

◆ options_default()

const config & ng::configure_engine::options_default ( ) const

Definition at line 170 of file configure_engine.cpp.

References preferences::options().

Referenced by set_random_faction_mode().

◆ random_faction_mode()

mp_game_settings::RANDOM_FACTION_MODE ng::configure_engine::random_faction_mode ( ) const
inline

Definition at line 129 of file configure_engine.hpp.

References parameters_.

◆ random_faction_mode_default()

mp_game_settings::RANDOM_FACTION_MODE ng::configure_engine::random_faction_mode_default ( ) const

◆ random_start_time()

bool ng::configure_engine::random_start_time ( ) const
inline

Definition at line 99 of file configure_engine.hpp.

References parameters_, and mp_game_settings::random_start_time.

◆ random_start_time_default()

bool ng::configure_engine::random_start_time_default ( ) const

◆ registered_users_only()

bool ng::configure_engine::registered_users_only ( ) const
inline

Definition at line 119 of file configure_engine.hpp.

References parameters_, and mp_game_settings::registered_users_only.

◆ registered_users_only_default()

bool ng::configure_engine::registered_users_only_default ( ) const

Definition at line 148 of file configure_engine.cpp.

References preferences::registered_users_only().

Referenced by set_random_faction_mode().

◆ set_allow_observers()

void ng::configure_engine::set_allow_observers ( bool  val)
inline

Definition at line 218 of file configure_engine.hpp.

References mp_game_settings::allow_observers, and parameters_.

◆ set_default_values()

void ng::configure_engine::set_default_values ( )

◆ set_fog_game()

void ng::configure_engine::set_fog_game ( bool  val)
inline

Definition at line 208 of file configure_engine.hpp.

References mp_game_settings::fog_game, and parameters_.

Referenced by set_default_values().

◆ set_game_name()

void ng::configure_engine::set_game_name ( std::string  name)
inline

Definition at line 143 of file configure_engine.hpp.

References mp_game_settings::name, and parameters_.

Referenced by set_default_values().

◆ set_game_password()

void ng::configure_engine::set_game_password ( std::string  name)
inline

Definition at line 148 of file configure_engine.hpp.

References parameters_, and mp_game_settings::password.

◆ set_mp_countdown()

void ng::configure_engine::set_mp_countdown ( bool  val)
inline

Definition at line 193 of file configure_engine.hpp.

References mp_game_settings::mp_countdown, and parameters_.

Referenced by set_default_values().

◆ set_mp_countdown_action_bonus()

void ng::configure_engine::set_mp_countdown_action_bonus ( int  val)
inline

Definition at line 188 of file configure_engine.hpp.

References mp_game_settings::mp_countdown_action_bonus, and parameters_.

Referenced by set_default_values().

◆ set_mp_countdown_init_time()

void ng::configure_engine::set_mp_countdown_init_time ( int  val)
inline

Definition at line 173 of file configure_engine.hpp.

References mp_game_settings::mp_countdown_init_time, and parameters_.

Referenced by set_default_values().

◆ set_mp_countdown_reservoir_time()

void ng::configure_engine::set_mp_countdown_reservoir_time ( int  val)
inline

Definition at line 178 of file configure_engine.hpp.

References mp_game_settings::mp_countdown_reservoir_time, and parameters_.

Referenced by set_default_values().

◆ set_mp_countdown_turn_bonus()

void ng::configure_engine::set_mp_countdown_turn_bonus ( int  val)
inline

Definition at line 183 of file configure_engine.hpp.

References mp_game_settings::mp_countdown_turn_bonus, and parameters_.

◆ set_num_turns()

void ng::configure_engine::set_num_turns ( int  val)
inline

Definition at line 153 of file configure_engine.hpp.

References mp_game_settings::num_turns, and parameters_.

Referenced by set_default_values().

◆ set_oos_debug()

void ng::configure_engine::set_oos_debug ( bool  val)
inline

◆ set_options()

void ng::configure_engine::set_options ( const config cfg)

◆ set_random_faction_mode()

void ng::configure_engine::set_random_faction_mode ( mp_game_settings::RANDOM_FACTION_MODE  val)
inline

◆ set_random_start_time()

void ng::configure_engine::set_random_start_time ( bool  val)
inline

Definition at line 203 of file configure_engine.hpp.

References parameters_, and mp_game_settings::random_start_time.

Referenced by set_default_values().

◆ set_registered_users_only()

void ng::configure_engine::set_registered_users_only ( bool  val)
inline

Definition at line 223 of file configure_engine.hpp.

References parameters_, and mp_game_settings::registered_users_only.

◆ set_shroud_game()

void ng::configure_engine::set_shroud_game ( bool  val)
inline

Definition at line 213 of file configure_engine.hpp.

References parameters_, and mp_game_settings::shroud_game.

Referenced by set_default_values().

◆ set_shuffle_sides()

void ng::configure_engine::set_shuffle_sides ( bool  val)
inline

Definition at line 233 of file configure_engine.hpp.

References parameters_, and mp_game_settings::shuffle_sides.

◆ set_use_map_settings()

void ng::configure_engine::set_use_map_settings ( bool  val)
inline

Definition at line 198 of file configure_engine.hpp.

References parameters_, and mp_game_settings::use_map_settings.

Referenced by configure_engine(), and set_default_values().

◆ set_village_gold()

void ng::configure_engine::set_village_gold ( int  val)
inline

Definition at line 158 of file configure_engine.hpp.

References parameters_, and mp_game_settings::village_gold.

Referenced by set_default_values().

◆ set_village_support()

void ng::configure_engine::set_village_support ( int  val)
inline

Definition at line 163 of file configure_engine.hpp.

References parameters_, and mp_game_settings::village_support.

Referenced by set_default_values().

◆ set_xp_modifier()

void ng::configure_engine::set_xp_modifier ( int  val)
inline

Definition at line 168 of file configure_engine.hpp.

References parameters_, and mp_game_settings::xp_modifier.

Referenced by set_default_values().

◆ shroud_game()

bool ng::configure_engine::shroud_game ( ) const
inline

Definition at line 109 of file configure_engine.hpp.

References parameters_, and mp_game_settings::shroud_game.

◆ shroud_game_default()

bool ng::configure_engine::shroud_game_default ( ) const

◆ shuffle_sides()

bool ng::configure_engine::shuffle_sides ( ) const
inline

Definition at line 124 of file configure_engine.hpp.

References parameters_, and mp_game_settings::shuffle_sides.

◆ shuffle_sides_default()

bool ng::configure_engine::shuffle_sides_default ( ) const

Definition at line 153 of file configure_engine.cpp.

References preferences::shuffle_sides().

Referenced by set_random_faction_mode().

◆ side_cfg()

const config& ng::configure_engine::side_cfg ( ) const
inlineprivate

Village gold, village support, fog, and shroud are per player but always show the player 1's values.

Todo:
This might not be 100% correct, but at the moment it is not possible to show fog and shroud per player. This might change in the future.
Todo:
: Is the above even still true? – vultraz, 2017-10-05

NOTE when 'load game' is selected there are no sides.

Definition at line 301 of file configure_engine.hpp.

References config::child_or_empty().

◆ update_initial_cfg()

void ng::configure_engine::update_initial_cfg ( const config cfg)
inline

Definition at line 276 of file configure_engine.hpp.

References initial_.

Referenced by sp::enter_configure_mode().

◆ use_map_settings()

bool ng::configure_engine::use_map_settings ( ) const
inline

◆ use_map_settings_default()

bool ng::configure_engine::use_map_settings_default ( ) const

◆ village_gold()

int ng::configure_engine::village_gold ( ) const
inline

Definition at line 54 of file configure_engine.hpp.

References parameters_, and mp_game_settings::village_gold.

◆ village_gold_default()

int ng::configure_engine::village_gold_default ( ) const

◆ village_support()

int ng::configure_engine::village_support ( ) const
inline

Definition at line 59 of file configure_engine.hpp.

References parameters_, and mp_game_settings::village_support.

◆ village_support_default()

int ng::configure_engine::village_support_default ( ) const

◆ write_parameters()

void ng::configure_engine::write_parameters ( )

◆ xp_modifier()

int ng::configure_engine::xp_modifier ( ) const
inline

Definition at line 64 of file configure_engine.hpp.

References parameters_, and mp_game_settings::xp_modifier.

◆ xp_modifier_default()

int ng::configure_engine::xp_modifier_default ( ) const

Member Data Documentation

◆ initial_

const config* ng::configure_engine::initial_
private

Never nullptr.

Definition at line 287 of file configure_engine.hpp.

Referenced by initial_cfg(), and update_initial_cfg().

◆ parameters_

mp_game_settings& ng::configure_engine::parameters_
private

◆ state_

saved_game& ng::configure_engine::state_
private

The documentation for this class was generated from the following files: