The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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, const bool faction_lock, const bool leader_lock, const bool saved_game)
 
 ~flg_manager ()
 
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)
 
void reset_leader_combo (gui::combo &combo_leader, const std::string &color) const
 
void reset_gender_combo (gui::combo &combo_gender, const std::string &color) const
 
bool is_random_faction ()
 
void resolve_random (rand_rng::mt_rng &rng, const std::vector< std::string > &avoid)
 
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::stringcurrent_leader () const
 
const std::stringcurrent_gender () const
 
const configdefault_leader_cfg () const
 
int current_faction_index () const
 

Private Member Functions

 flg_manager (const flg_manager &)
 
void operator= (const flg_manager &)
 
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)
 
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...
 
int current_leader_index () const
 
int current_gender_index () const
 

Static Private Member Functions

static std::vector< std::stringget_original_recruits (const config &cfg)
 
static const configget_default_faction (const config &cfg)
 

Private Attributes

const std::vector< const
config * > & 
era_factions_
 
const configside_
 
const bool use_map_settings_
 
const bool saved_game_
 
const bool has_no_recruits_
 
const bool faction_lock_
 
const bool leader_lock_
 
std::vector< const config * > available_factions_
 
std::vector< std::stringavailable_leaders_
 
std::vector< std::stringavailable_genders_
 
std::vector< const config * > choosable_factions_
 
std::vector< std::stringchoosable_leaders_
 
std::vector< std::stringchoosable_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 32 of file flg_manager.hpp.

Constructor & Destructor Documentation

ng::flg_manager::flg_manager ( const std::vector< const config * > &  era_factions,
const config side,
const bool  faction_lock,
const bool  leader_lock,
const bool  saved_game 
)
ng::flg_manager::~flg_manager ( )

Definition at line 104 of file flg_manager.cpp.

ng::flg_manager::flg_manager ( const flg_manager )
private

Member Function Documentation

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

Definition at line 568 of file flg_manager.cpp.

References available_leaders_, and utils::split().

Referenced by update_available_leaders().

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

Definition at line 63 of file flg_manager.hpp.

References choosable_factions_.

Referenced by mp::wait::join_game().

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

Definition at line 67 of file flg_manager.hpp.

References choosable_genders_.

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

Definition at line 65 of file flg_manager.hpp.

References choosable_leaders_.

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

Definition at line 561 of file flg_manager.cpp.

References current_faction_, and faction_index().

const std::string& ng::flg_manager::current_gender ( ) const
inline
int ng::flg_manager::current_gender_index ( ) const
inlineprivate

Definition at line 104 of file flg_manager.hpp.

References current_gender_, and gender_index().

Referenced by reset_gender_combo().

const std::string& ng::flg_manager::current_leader ( ) const
inline
int ng::flg_manager::current_leader_index ( ) const
inlineprivate

Definition at line 102 of file flg_manager.hpp.

References current_leader_, and leader_index().

Referenced by reset_leader_combo().

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

Definition at line 76 of file flg_manager.hpp.

References default_leader_cfg_.

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

int ng::flg_manager::faction_index ( const config faction) const
private
int ng::flg_manager::find_suitable_faction ( ) const
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 594 of file flg_manager.cpp.

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

Referenced by current_gender_index(), and set_current_gender().

const config & ng::flg_manager::get_default_faction ( const config cfg)
staticprivate
std::vector< std::string > ng::flg_manager::get_original_recruits ( const config cfg)
staticprivate

Definition at line 624 of file flg_manager.cpp.

References get_default_faction(), and utils::split().

Referenced by find_suitable_faction().

bool ng::flg_manager::is_random_faction ( )
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 586 of file flg_manager.cpp.

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

Referenced by current_leader_index(), and set_current_leader().

void ng::flg_manager::operator= ( const flg_manager )
private
void ng::flg_manager::reset_gender_combo ( gui::combo combo_gender,
const std::string color 
) const
void ng::flg_manager::reset_leader_combo ( gui::combo combo_leader,
const std::string color 
) const
void ng::flg_manager::resolve_random ( rand_rng::mt_rng rng,
const std::vector< std::string > &  avoid 
)
void ng::flg_manager::set_current_faction ( const unsigned  index)
void ng::flg_manager::set_current_faction ( const std::string id)

Definition at line 117 of file flg_manager.cpp.

References choosable_factions_, ERR_MP, set_current_faction(), and side_.

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

Definition at line 42 of file flg_manager.hpp.

References faction_index(), and set_current_faction().

void ng::flg_manager::set_current_gender ( const unsigned  index)
void ng::flg_manager::set_current_gender ( const std::string gender)

Definition at line 613 of file flg_manager.cpp.

References ERR_MP, gender_index(), set_current_gender(), and side_.

void ng::flg_manager::set_current_leader ( const unsigned  index)
void ng::flg_manager::set_current_leader ( const std::string leader)

Definition at line 602 of file flg_manager.cpp.

References ERR_MP, leader_index(), set_current_leader(), and side_.

void ng::flg_manager::update_available_factions ( )
private
void ng::flg_manager::update_available_genders ( )
private
void ng::flg_manager::update_available_leaders ( )
private
void ng::flg_manager::update_choosable_factions ( )
private
void ng::flg_manager::update_choosable_genders ( )
private
void ng::flg_manager::update_choosable_leaders ( )
private

Member Data Documentation

std::vector<const config*> ng::flg_manager::available_factions_
private
std::vector<std::string> ng::flg_manager::available_genders_
private
std::vector<std::string> ng::flg_manager::available_leaders_
private
std::vector<const config*> ng::flg_manager::choosable_factions_
private
std::vector<std::string> ng::flg_manager::choosable_genders_
private
std::vector<std::string> ng::flg_manager::choosable_leaders_
private
const config* ng::flg_manager::current_faction_
private
std::string ng::flg_manager::current_gender_
private
std::string ng::flg_manager::current_leader_
private
const config* ng::flg_manager::default_leader_cfg_
private

Definition at line 133 of file flg_manager.hpp.

Referenced by default_leader_cfg(), and flg_manager().

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

Definition at line 107 of file flg_manager.hpp.

Referenced by update_available_factions().

const bool ng::flg_manager::faction_lock_
private

Definition at line 115 of file flg_manager.hpp.

Referenced by update_available_factions(), and update_choosable_factions().

const bool ng::flg_manager::has_no_recruits_
private

Definition at line 113 of file flg_manager.hpp.

Referenced by update_available_factions().

const bool ng::flg_manager::leader_lock_
private
const bool ng::flg_manager::saved_game_
private
const config& ng::flg_manager::side_
private
const bool ng::flg_manager::use_map_settings_
private

Definition at line 111 of file flg_manager.hpp.


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