The Battle for Wesnoth  1.15.2+dev
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ng::flg_manager Class Reference

FLG stands for faction, leader and gender. More...

#include <flg_manager.hpp>

Public Member Functions

 flg_manager (const std::vector< const config *> &era_factions, const config &side, bool lock_settings, bool use_map_settings, bool saved_game)
 
void set_current_faction (const unsigned index)
 
void set_current_faction (const std::string &id)
 
void set_current_faction (const config &faction)
 
void set_current_leader (const unsigned index)
 
void set_current_leader (const std::string &leader)
 
void set_current_gender (const unsigned index)
 
void set_current_gender (const std::string &gender)
 
bool is_random_faction ()
 
void resolve_random (randomness::mt_rng &rng, const std::vector< std::string > &avoid)
 
bool is_saved_game () const
 
int find_suitable_faction () const
 
const std::vector< const config * > & choosable_factions () const
 
const std::vector< std::string > & choosable_leaders () const
 
const std::vector< std::string > & choosable_genders () const
 
const configcurrent_faction () const
 
const std::string & current_leader () const
 
const std::string & current_gender () const
 
const configdefault_leader_cfg () const
 
int current_faction_index () const
 
int current_leader_index () const
 
int current_gender_index () const
 

Private Member Functions

 flg_manager (const flg_manager &)=delete
 
void operator= (const flg_manager &)=delete
 
void update_available_factions ()
 
void update_available_leaders ()
 
void update_available_genders ()
 
void update_choosable_factions ()
 
void update_choosable_leaders ()
 
void update_choosable_genders ()
 
void append_leaders_from_faction (const config *faction)
 
void select_default_faction ()
 
int faction_index (const config &faction) const
 
int leader_index (const std::string &leader) const
 returns -1 if no leader with that name was found More...
 
int gender_index (const std::string &gender) const
 returns -1 if no gender with that name was found More...
 

Static Private Member Functions

static const configget_default_faction (const config &cfg)
 

Private Attributes

const std::vector< const config * > & era_factions_
 
const int side_num_
 
const bool faction_from_recruit_
 
const std::string original_type_
 
const std::string original_gender_
 
std::string savegame_gender_
 
const std::string original_faction_
 
const std::vector< std::string > original_recruit_
 
const std::string choose_faction_by_leader_
 
const bool saved_game_
 
const bool has_no_recruits_
 
bool faction_lock_
 
bool leader_lock_
 
std::vector< const config * > available_factions_
 
std::vector< std::string > available_leaders_
 
std::vector< std::string > available_genders_
 
std::vector< const config * > choosable_factions_
 
std::vector< std::string > choosable_leaders_
 
std::vector< std::string > choosable_genders_
 
const configcurrent_faction_
 
std::string current_leader_
 
std::string current_gender_
 
std::string default_leader_type_
 
std::string default_leader_gender_
 
const configdefault_leader_cfg_
 

Detailed Description

FLG stands for faction, leader and gender.

Definition at line 28 of file flg_manager.hpp.

Constructor & Destructor Documentation

◆ flg_manager() [1/2]

ng::flg_manager::flg_manager ( const std::vector< const config *> &  era_factions,
const config side,
bool  lock_settings,
bool  use_map_settings,
bool  saved_game 
)

◆ flg_manager() [2/2]

ng::flg_manager::flg_manager ( const flg_manager )
privatedelete

Member Function Documentation

◆ append_leaders_from_faction()

void ng::flg_manager::append_leaders_from_faction ( const config faction)
private

Definition at line 496 of file flg_manager.cpp.

References available_leaders_, and utils::split().

Referenced by update_available_leaders().

◆ choosable_factions()

const std::vector<const config*>& ng::flg_manager::choosable_factions ( ) const
inline

Definition at line 60 of file flg_manager.hpp.

Referenced by gui2::dialogs::faction_select::pre_show().

◆ choosable_genders()

const std::vector<std::string>& ng::flg_manager::choosable_genders ( ) const
inline

Definition at line 64 of file flg_manager.hpp.

Referenced by gui2::dialogs::faction_select::on_leader_select().

◆ choosable_leaders()

const std::vector<std::string>& ng::flg_manager::choosable_leaders ( ) const
inline

Definition at line 62 of file flg_manager.hpp.

Referenced by gui2::dialogs::faction_select::on_faction_select().

◆ current_faction()

const config& ng::flg_manager::current_faction ( ) const
inline

◆ current_faction_index()

int ng::flg_manager::current_faction_index ( ) const

Definition at line 489 of file flg_manager.cpp.

References current_faction_, and faction_index().

Referenced by gui2::dialogs::faction_select::pre_show().

◆ current_gender()

const std::string& ng::flg_manager::current_gender ( ) const
inline

◆ current_gender_index()

int ng::flg_manager::current_gender_index ( ) const
inline

Definition at line 80 of file flg_manager.hpp.

◆ current_leader()

const std::string& ng::flg_manager::current_leader ( ) const
inline

◆ current_leader_index()

int ng::flg_manager::current_leader_index ( ) const
inline

Definition at line 78 of file flg_manager.hpp.

Referenced by gui2::dialogs::faction_select::on_faction_select().

◆ default_leader_cfg()

const config* ng::flg_manager::default_leader_cfg ( ) const
inline

Definition at line 73 of file flg_manager.hpp.

Referenced by ng::side_engine::new_config().

◆ faction_index()

int ng::flg_manager::faction_index ( const config faction) const
private

◆ find_suitable_faction()

int ng::flg_manager::find_suitable_faction ( ) const

◆ gender_index()

int ng::flg_manager::gender_index ( const std::string &  gender) const
private

returns -1 if no gender with that name was found

Definition at line 519 of file flg_manager.cpp.

References choosable_genders_, and gui2::event::find().

Referenced by set_current_gender().

◆ get_default_faction()

const config & ng::flg_manager::get_default_faction ( const config cfg)
staticprivate

Definition at line 546 of file flg_manager.cpp.

References config::child().

◆ is_random_faction()

bool ng::flg_manager::is_random_faction ( )

◆ is_saved_game()

bool ng::flg_manager::is_saved_game ( ) const
inline

Definition at line 51 of file flg_manager.hpp.

Referenced by gui2::dialogs::faction_select::on_faction_select().

◆ leader_index()

int ng::flg_manager::leader_index ( const std::string &  leader) const
private

returns -1 if no leader with that name was found

Definition at line 512 of file flg_manager.cpp.

References choosable_leaders_, and gui2::event::find().

Referenced by set_current_leader().

◆ operator=()

void ng::flg_manager::operator= ( const flg_manager )
privatedelete

◆ resolve_random()

void ng::flg_manager::resolve_random ( randomness::mt_rng rng,
const std::vector< std::string > &  avoid 
)

◆ select_default_faction()

void ng::flg_manager::select_default_faction ( )
private

Definition at line 429 of file flg_manager.cpp.

References choosable_factions_, original_faction_, and set_current_faction().

Referenced by flg_manager().

◆ set_current_faction() [1/3]

void ng::flg_manager::set_current_faction ( const unsigned  index)

◆ set_current_faction() [2/3]

void ng::flg_manager::set_current_faction ( const std::string &  id)

◆ set_current_faction() [3/3]

void ng::flg_manager::set_current_faction ( const config faction)
inline

Definition at line 36 of file flg_manager.hpp.

◆ set_current_gender() [1/2]

void ng::flg_manager::set_current_gender ( const unsigned  index)

◆ set_current_gender() [2/2]

void ng::flg_manager::set_current_gender ( const std::string &  gender)

Definition at line 536 of file flg_manager.cpp.

References ERR_MP, gender_index(), utf8::index(), set_current_gender(), and side_num_.

◆ set_current_leader() [1/2]

void ng::flg_manager::set_current_leader ( const unsigned  index)

◆ set_current_leader() [2/2]

void ng::flg_manager::set_current_leader ( const std::string &  leader)

Definition at line 526 of file flg_manager.cpp.

References ERR_MP, utf8::index(), leader_index(), set_current_leader(), and side_num_.

◆ update_available_factions()

void ng::flg_manager::update_available_factions ( )
private

◆ update_available_genders()

void ng::flg_manager::update_available_genders ( )
private

◆ update_available_leaders()

void ng::flg_manager::update_available_leaders ( )
private

◆ update_choosable_factions()

void ng::flg_manager::update_choosable_factions ( )
private

◆ update_choosable_genders()

void ng::flg_manager::update_choosable_genders ( )
private

◆ update_choosable_leaders()

void ng::flg_manager::update_choosable_leaders ( )
private

Member Data Documentation

◆ available_factions_

std::vector<const config*> ng::flg_manager::available_factions_
private

◆ available_genders_

std::vector<std::string> ng::flg_manager::available_genders_
private

◆ available_leaders_

std::vector<std::string> ng::flg_manager::available_leaders_
private

◆ choosable_factions_

std::vector<const config*> ng::flg_manager::choosable_factions_
private

◆ choosable_genders_

std::vector<std::string> ng::flg_manager::choosable_genders_
private

Definition at line 130 of file flg_manager.hpp.

Referenced by gender_index(), set_current_gender(), and update_choosable_genders().

◆ choosable_leaders_

std::vector<std::string> ng::flg_manager::choosable_leaders_
private

Definition at line 129 of file flg_manager.hpp.

Referenced by leader_index(), set_current_leader(), and update_choosable_leaders().

◆ choose_faction_by_leader_

const std::string ng::flg_manager::choose_faction_by_leader_
private

Definition at line 116 of file flg_manager.hpp.

Referenced by find_suitable_faction().

◆ current_faction_

const config* ng::flg_manager::current_faction_
private

◆ current_gender_

std::string ng::flg_manager::current_gender_
private

Definition at line 134 of file flg_manager.hpp.

Referenced by resolve_random(), and set_current_gender().

◆ current_leader_

std::string ng::flg_manager::current_leader_
private

◆ default_leader_cfg_

const config* ng::flg_manager::default_leader_cfg_
private

Definition at line 138 of file flg_manager.hpp.

Referenced by flg_manager().

◆ default_leader_gender_

std::string ng::flg_manager::default_leader_gender_
private

◆ default_leader_type_

std::string ng::flg_manager::default_leader_type_
private

◆ era_factions_

const std::vector<const config*>& ng::flg_manager::era_factions_
private

Definition at line 105 of file flg_manager.hpp.

Referenced by update_available_factions().

◆ faction_from_recruit_

const bool ng::flg_manager::faction_from_recruit_
private

Definition at line 109 of file flg_manager.hpp.

Referenced by find_suitable_faction().

◆ faction_lock_

bool ng::flg_manager::faction_lock_
private

◆ has_no_recruits_

const bool ng::flg_manager::has_no_recruits_
private

Definition at line 118 of file flg_manager.hpp.

Referenced by update_available_factions().

◆ leader_lock_

bool ng::flg_manager::leader_lock_
private

◆ original_faction_

const std::string ng::flg_manager::original_faction_
private

◆ original_gender_

const std::string ng::flg_manager::original_gender_
private

Definition at line 112 of file flg_manager.hpp.

◆ original_recruit_

const std::vector<std::string> ng::flg_manager::original_recruit_
private

Definition at line 115 of file flg_manager.hpp.

Referenced by find_suitable_faction().

◆ original_type_

const std::string ng::flg_manager::original_type_
private

Definition at line 111 of file flg_manager.hpp.

◆ saved_game_

const bool ng::flg_manager::saved_game_
private

Definition at line 117 of file flg_manager.hpp.

Referenced by update_available_genders(), and update_available_leaders().

◆ savegame_gender_

std::string ng::flg_manager::savegame_gender_
private

Definition at line 113 of file flg_manager.hpp.

Referenced by flg_manager(), and update_available_genders().

◆ side_num_

const int ng::flg_manager::side_num_
private

Definition at line 108 of file flg_manager.hpp.

Referenced by set_current_faction(), set_current_gender(), and set_current_leader().


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