The Battle for Wesnoth  1.19.7+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
 
auto mp_countdown_init_time () const
 
auto mp_countdown_reservoir_time () const
 
auto mp_countdown_turn_bonus () const
 
auto 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 shuffle_sides () const
 
random_faction_mode::type mode () const
 
const configoptions () const
 
void set_game_name (const std::string &name)
 
void set_game_password (const 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 (const std::chrono::seconds &val)
 
void set_mp_countdown_reservoir_time (const std::chrono::seconds &val)
 
void set_mp_countdown_turn_bonus (const std::chrono::seconds &val)
 
void set_mp_countdown_action_bonus (const std::chrono::seconds &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_private_replay (bool val)
 
void set_oos_debug (bool val)
 
void set_shuffle_sides (bool val)
 
void set_random_faction_mode (random_faction_mode::type 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
 
std::chrono::seconds mp_countdown_init_time_default () const
 
std::chrono::seconds mp_countdown_reservoir_time_default () const
 
std::chrono::seconds mp_countdown_turn_bonus_default () const
 
std::chrono::seconds 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 shuffle_sides_default () const
 
random_faction_mode::type 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 31 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 26 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 116 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 139 of file configure_engine.cpp.

References prefs::get().

◆ fog_game()

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

Definition at line 106 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 52 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 46 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 265 of file configure_engine.hpp.

References parameters_.

◆ initial_cfg()

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

◆ mode()

random_faction_mode::type ng::configure_engine::mode ( ) const
inline

Definition at line 126 of file configure_engine.hpp.

References mp_game_settings::mode, and parameters_.

◆ mp_countdown()

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

Definition at line 91 of file configure_engine.hpp.

References mp_game_settings::mp_countdown, and parameters_.

◆ mp_countdown_action_bonus()

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

◆ mp_countdown_action_bonus_default()

std::chrono::seconds ng::configure_engine::mp_countdown_action_bonus_default ( ) const

Definition at line 105 of file configure_engine.cpp.

References prefs::countdown_action_bonus(), and prefs::get().

Referenced by set_default_values().

◆ mp_countdown_default()

bool ng::configure_engine::mp_countdown_default ( ) const

Definition at line 110 of file configure_engine.cpp.

References prefs::get().

Referenced by set_default_values().

◆ mp_countdown_init_time()

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

Definition at line 71 of file configure_engine.hpp.

References mp_game_settings::mp_countdown_init_time, and parameters_.

◆ mp_countdown_init_time_default()

std::chrono::seconds ng::configure_engine::mp_countdown_init_time_default ( ) const

Definition at line 90 of file configure_engine.cpp.

References prefs::countdown_init_time(), and prefs::get().

Referenced by set_default_values().

◆ mp_countdown_reservoir_time()

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

◆ mp_countdown_reservoir_time_default()

std::chrono::seconds ng::configure_engine::mp_countdown_reservoir_time_default ( ) const

Definition at line 95 of file configure_engine.cpp.

References prefs::countdown_reservoir_time(), and prefs::get().

Referenced by set_default_values().

◆ mp_countdown_turn_bonus()

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

Definition at line 81 of file configure_engine.hpp.

References mp_game_settings::mp_countdown_turn_bonus, and parameters_.

◆ mp_countdown_turn_bonus_default()

std::chrono::seconds ng::configure_engine::mp_countdown_turn_bonus_default ( ) const

Definition at line 100 of file configure_engine.cpp.

References prefs::countdown_turn_bonus(), and prefs::get().

◆ num_turns()

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

Definition at line 51 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 131 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 160 of file configure_engine.cpp.

References prefs::get(), and prefs::options().

◆ random_faction_mode_default()

random_faction_mode::type ng::configure_engine::random_faction_mode_default ( ) const

◆ random_start_time()

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

Definition at line 101 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

Definition at line 120 of file configure_engine.cpp.

References prefs::get(), initial_cfg(), and use_map_settings().

Referenced by set_default_values().

◆ set_allow_observers()

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

Definition at line 215 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 205 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 ( const std::string &  name)
inline

Definition at line 140 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 ( const std::string &  name)
inline

Definition at line 145 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 190 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 ( const std::chrono::seconds &  val)
inline

Definition at line 185 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 ( const std::chrono::seconds &  val)
inline

Definition at line 170 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 ( const std::chrono::seconds &  val)
inline

Definition at line 175 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 ( const std::chrono::seconds &  val)
inline

Definition at line 180 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 150 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_private_replay()

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

Definition at line 220 of file configure_engine.hpp.

References parameters_, and mp_game_settings::private_replay.

◆ set_random_faction_mode()

void ng::configure_engine::set_random_faction_mode ( random_faction_mode::type  val)
inline

Definition at line 235 of file configure_engine.hpp.

References mp_game_settings::mode, and parameters_.

Referenced by set_default_values().

◆ set_random_start_time()

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

Definition at line 200 of file configure_engine.hpp.

References parameters_, and mp_game_settings::random_start_time.

Referenced by set_default_values().

◆ set_shroud_game()

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

Definition at line 210 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 230 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 195 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 155 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 160 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 165 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 111 of file configure_engine.hpp.

References parameters_, and mp_game_settings::shroud_game.

◆ shroud_game_default()

bool ng::configure_engine::shroud_game_default ( ) const

Definition at line 134 of file configure_engine.cpp.

References prefs::get(), initial_cfg(), and use_map_settings().

Referenced by set_default_values().

◆ shuffle_sides()

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

Definition at line 121 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 144 of file configure_engine.cpp.

References prefs::get().

◆ 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 297 of file configure_engine.hpp.

References config::child_or_empty(), and initial_.

◆ update_initial_cfg()

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

Definition at line 272 of file configure_engine.hpp.

References initial_.

Referenced by sp::configure_campaign().

◆ 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

Definition at line 115 of file configure_engine.cpp.

References force_lock_settings(), and prefs::get().

Referenced by configure_engine(), and set_default_values().

◆ village_gold()

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

Definition at line 56 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 61 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 66 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 283 of file configure_engine.hpp.

Referenced by initial_cfg(), side_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: