FLG stands for faction, leader and gender. More...
#include <flg_manager.hpp>
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::string > | get_original_recruits (const config &cfg) |
static const config & | get_default_faction (const config &cfg) |
Private Attributes | |
const std::vector< const config * > & | era_factions_ |
const config & | side_ |
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::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 config * | current_faction_ |
std::string | current_leader_ |
std::string | current_gender_ |
std::string | default_leader_type_ |
std::string | default_leader_gender_ |
const config * | default_leader_cfg_ |
FLG stands for faction, leader and gender.
Definition at line 32 of file flg_manager.hpp.
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 | ||
) |
Definition at line 46 of file flg_manager.cpp.
References config::child_range(), default_leader_cfg_, default_leader_gender_, default_leader_type_, unit_type_data::find(), config::find_child(), set_current_faction(), side_, unit_types, and update_available_factions().
ng::flg_manager::~flg_manager | ( | ) |
Definition at line 104 of file flg_manager.cpp.
|
private |
Definition at line 568 of file flg_manager.cpp.
References available_leaders_, and utils::split().
Referenced by update_available_leaders().
|
inline |
Definition at line 63 of file flg_manager.hpp.
References choosable_factions_.
Referenced by mp::wait::join_game().
|
inline |
Definition at line 67 of file flg_manager.hpp.
References choosable_genders_.
|
inline |
Definition at line 65 of file flg_manager.hpp.
References choosable_leaders_.
|
inline |
Definition at line 69 of file flg_manager.hpp.
References current_faction_.
Referenced by mp::wait::join_game(), ng::side_engine::new_config(), and ng::side_engine::resolve_random().
int ng::flg_manager::current_faction_index | ( | ) | const |
Definition at line 561 of file flg_manager.cpp.
References current_faction_, and faction_index().
|
inline |
Definition at line 73 of file flg_manager.hpp.
References current_gender_.
Referenced by mp::wait::join_game(), ng::side_engine::new_config(), and ng::side_engine::resolve_random().
|
inlineprivate |
Definition at line 104 of file flg_manager.hpp.
References current_gender_, and gender_index().
Referenced by reset_gender_combo().
|
inline |
Definition at line 71 of file flg_manager.hpp.
References current_leader_.
Referenced by mp::wait::join_game(), ng::side_engine::new_config(), and ng::side_engine::resolve_random().
|
inlineprivate |
Definition at line 102 of file flg_manager.hpp.
References current_leader_, and leader_index().
Referenced by reset_leader_combo().
|
inline |
Definition at line 76 of file flg_manager.hpp.
References default_leader_cfg_.
Referenced by ng::side_engine::new_config().
Definition at line 577 of file flg_manager.cpp.
References choosable_factions_, and gui2::event::find().
Referenced by current_faction_index(), resolve_random(), set_current_faction(), and update_choosable_factions().
int ng::flg_manager::find_suitable_faction | ( | ) | const |
Definition at line 516 of file flg_manager.cpp.
References choosable_factions_, gui2::event::find(), config::get(), get_default_faction(), get_original_recruits(), side_, and utils::split().
Referenced by update_choosable_factions().
|
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().
Definition at line 629 of file flg_manager.cpp.
References config::child().
Referenced by find_suitable_faction(), get_original_recruits(), and update_available_factions().
|
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 | ( | ) |
Definition at line 204 of file flg_manager.cpp.
References current_faction_.
Referenced by resolve_random(), ng::side_engine::resolve_random(), and update_available_leaders().
|
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().
|
private |
void ng::flg_manager::reset_gender_combo | ( | gui::combo & | combo_gender, |
const std::string & | color | ||
) | const |
Definition at line 171 of file flg_manager.cpp.
References _(), choosable_genders_, COLUMN_SEPARATOR, current_gender_index(), current_leader_, gui::button::enable(), unit_type_data::find(), unit_type::flag_rgb(), unit_type::get_gender_unit_type(), ng::get_RC_suffix(), unit_type::image(), IMAGE_PREFIX, ng::random_enemy_picture(), unit_race::s_female, unit_race::s_male, saved_game_, gui::combo::set_items(), gui::combo::set_selected(), utils::unicode_em_dash, and unit_types.
Referenced by mp::wait::leader_preview_pane::leader_preview_pane().
void ng::flg_manager::reset_leader_combo | ( | gui::combo & | combo_leader, |
const std::string & | color | ||
) | const |
Definition at line 146 of file flg_manager.cpp.
References _(), choosable_leaders_, COLUMN_SEPARATOR, current_leader_index(), gui::button::enable(), unit_type_data::find(), unit_type::flag_rgb(), ng::get_RC_suffix(), unit_type::image(), IMAGE_PREFIX, ng::random_enemy_picture(), saved_game_, gui::combo::set_items(), gui::combo::set_selected(), unit_type::type_name(), utils::unicode_em_dash, and unit_types.
Referenced by mp::wait::leader_preview_pane::leader_preview_pane().
void ng::flg_manager::resolve_random | ( | rand_rng::mt_rng & | rng, |
const std::vector< std::string > & | avoid | ||
) |
Definition at line 218 of file flg_manager.cpp.
References _(), available_factions_, available_genders_, available_leaders_, current_faction_, current_gender_, current_leader_, error(), faction_index(), gui2::event::find(), unit_type_data::find(), rand_rng::mt_rng::get_next_random(), i, is_random_faction(), set_current_gender(), set_current_leader(), utils::split(), unit_types, update_available_genders(), update_available_leaders(), and vgettext().
Referenced by ng::side_engine::resolve_random().
void ng::flg_manager::set_current_faction | ( | const unsigned | index | ) |
Definition at line 108 of file flg_manager.cpp.
References choosable_factions_, current_faction_, set_current_leader(), and update_available_leaders().
Referenced by flg_manager(), ng::side_engine::place_user(), ng::side_engine::reset(), set_current_faction(), and ng::side_engine::set_faction_commandline().
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_.
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 | ) |
Definition at line 140 of file flg_manager.cpp.
References choosable_genders_, and current_gender_.
Referenced by ng::side_engine::place_user(), resolve_random(), set_current_gender(), and set_current_leader().
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 | ) |
Definition at line 131 of file flg_manager.cpp.
References choosable_leaders_, current_leader_, set_current_gender(), and update_available_genders().
Referenced by ng::side_engine::place_user(), resolve_random(), set_current_faction(), and set_current_leader().
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_.
|
private |
Definition at line 331 of file flg_manager.cpp.
References available_factions_, era_factions_, faction_lock_, get_default_faction(), has_no_recruits_, side_, and update_choosable_factions().
Referenced by flg_manager().
|
private |
Definition at line 417 of file flg_manager.cpp.
References available_genders_, config::child_range(), current_leader_, default_leader_gender_, unit_race::FEMALE, unit_type_data::find(), unit_type::genders(), leader_lock_, unit_race::s_female, unit_race::s_male, saved_game_, side_, unit_types, and update_choosable_genders().
Referenced by resolve_random(), and set_current_leader().
|
private |
Definition at line 362 of file flg_manager.cpp.
References append_leaders_from_faction(), available_factions_, available_leaders_, current_faction_, default_leader_type_, is_random_faction(), leader_lock_, saved_game_, side_, and update_choosable_leaders().
Referenced by resolve_random(), and set_current_faction().
|
private |
Definition at line 469 of file flg_manager.cpp.
References available_factions_, choosable_factions_, faction_index(), faction_lock_, and find_suitable_faction().
Referenced by update_available_factions().
|
private |
Definition at line 497 of file flg_manager.cpp.
References available_genders_, choosable_genders_, default_leader_gender_, gui2::event::find(), and leader_lock_.
Referenced by update_available_genders().
|
private |
Definition at line 483 of file flg_manager.cpp.
References available_leaders_, choosable_leaders_, default_leader_type_, gui2::event::find(), and leader_lock_.
Referenced by update_available_leaders().
|
private |
Definition at line 119 of file flg_manager.hpp.
Referenced by resolve_random(), update_available_factions(), update_available_leaders(), and update_choosable_factions().
|
private |
Definition at line 121 of file flg_manager.hpp.
Referenced by resolve_random(), update_available_genders(), and update_choosable_genders().
|
private |
Definition at line 120 of file flg_manager.hpp.
Referenced by append_leaders_from_faction(), resolve_random(), update_available_leaders(), and update_choosable_leaders().
|
private |
Definition at line 123 of file flg_manager.hpp.
Referenced by choosable_factions(), faction_index(), find_suitable_faction(), set_current_faction(), and update_choosable_factions().
|
private |
Definition at line 125 of file flg_manager.hpp.
Referenced by choosable_genders(), gender_index(), reset_gender_combo(), set_current_gender(), and update_choosable_genders().
|
private |
Definition at line 124 of file flg_manager.hpp.
Referenced by choosable_leaders(), leader_index(), reset_leader_combo(), set_current_leader(), and update_choosable_leaders().
|
private |
Definition at line 127 of file flg_manager.hpp.
Referenced by current_faction(), current_faction_index(), is_random_faction(), resolve_random(), set_current_faction(), and update_available_leaders().
|
private |
Definition at line 129 of file flg_manager.hpp.
Referenced by current_gender(), current_gender_index(), resolve_random(), and set_current_gender().
|
private |
Definition at line 128 of file flg_manager.hpp.
Referenced by current_leader(), current_leader_index(), reset_gender_combo(), resolve_random(), set_current_leader(), and update_available_genders().
|
private |
Definition at line 133 of file flg_manager.hpp.
Referenced by default_leader_cfg(), and flg_manager().
|
private |
Definition at line 132 of file flg_manager.hpp.
Referenced by flg_manager(), update_available_genders(), and update_choosable_genders().
|
private |
Definition at line 131 of file flg_manager.hpp.
Referenced by flg_manager(), update_available_leaders(), and update_choosable_leaders().
|
private |
Definition at line 107 of file flg_manager.hpp.
Referenced by update_available_factions().
|
private |
Definition at line 115 of file flg_manager.hpp.
Referenced by update_available_factions(), and update_choosable_factions().
|
private |
Definition at line 113 of file flg_manager.hpp.
Referenced by update_available_factions().
|
private |
Definition at line 116 of file flg_manager.hpp.
Referenced by update_available_genders(), update_available_leaders(), update_choosable_genders(), and update_choosable_leaders().
|
private |
Definition at line 112 of file flg_manager.hpp.
Referenced by reset_gender_combo(), reset_leader_combo(), update_available_genders(), and update_available_leaders().
|
private |
Definition at line 109 of file flg_manager.hpp.
Referenced by find_suitable_faction(), flg_manager(), set_current_faction(), set_current_gender(), set_current_leader(), update_available_factions(), update_available_genders(), and update_available_leaders().
|
private |
Definition at line 111 of file flg_manager.hpp.