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 config & | current_faction () const |
const std::string & | current_leader () const |
const std::string & | current_gender () const |
const config * | default_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 | |
flg_manager & | 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 config & | get_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 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 29 of file flg_manager.hpp.
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 | ||
) |
Definition at line 35 of file flg_manager.cpp.
References config::child_range(), current_leader_, default_leader_cfg_, default_leader_gender_, default_leader_type_, faction_lock_, unit_type_data::find(), config::find_child(), leader_lock_, savegame_gender_, select_default_faction(), unit_types, and update_available_factions().
|
privatedelete |
|
private |
Definition at line 494 of file flg_manager.cpp.
References available_leaders_, and utils::split().
Referenced by update_available_leaders().
|
inline |
Definition at line 61 of file flg_manager.hpp.
References choosable_factions_.
Referenced by gui2::dialogs::faction_select::pre_show().
|
inline |
Definition at line 65 of file flg_manager.hpp.
References choosable_genders_.
Referenced by gui2::dialogs::faction_select::on_leader_select().
|
inline |
Definition at line 63 of file flg_manager.hpp.
References choosable_leaders_.
Referenced by gui2::dialogs::faction_select::on_faction_select().
|
inline |
Definition at line 67 of file flg_manager.hpp.
References current_faction_.
Referenced by ng::side_engine::new_config(), gui2::dialogs::faction_select::on_faction_select(), ng::side_engine::resolve_random(), and gui2::dialogs::mp_join_game::show_flg_select().
int ng::flg_manager::current_faction_index | ( | ) | const |
Definition at line 487 of file flg_manager.cpp.
References current_faction_, and faction_index().
Referenced by gui2::dialogs::faction_select::pre_show().
|
inline |
Definition at line 71 of file flg_manager.hpp.
References current_gender_.
Referenced by ng::side_engine::new_config(), ng::side_engine::resolve_random(), gui2::dialogs::mp_join_game::show_flg_select(), and gui2::dialogs::faction_select::update_leader_image().
|
inline |
Definition at line 81 of file flg_manager.hpp.
References current_gender_, and gender_index().
|
inline |
Definition at line 69 of file flg_manager.hpp.
References current_leader_.
Referenced by ng::side_engine::new_config(), gui2::dialogs::faction_select::on_leader_select(), gui2::dialogs::faction_select::profile_button_callback(), ng::side_engine::resolve_random(), gui2::dialogs::mp_join_game::show_flg_select(), and gui2::dialogs::faction_select::update_leader_image().
|
inline |
Definition at line 79 of file flg_manager.hpp.
References current_leader_, and leader_index().
Referenced by gui2::dialogs::faction_select::on_faction_select().
|
inline |
Definition at line 74 of file flg_manager.hpp.
References default_leader_cfg_.
Referenced by ng::side_engine::new_config().
|
private |
Definition at line 502 of file flg_manager.cpp.
References choosable_factions_.
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 442 of file flg_manager.cpp.
References choosable_factions_, choose_faction_by_leader_, faction_from_recruit_, utf8::index(), original_faction_, original_recruit_, and utils::split().
Referenced by update_choosable_factions().
|
private |
returns -1 if no gender with that name was found
Definition at line 517 of file flg_manager.cpp.
References choosable_genders_.
Referenced by current_gender_index(), and set_current_gender().
Definition at line 544 of file flg_manager.cpp.
References config::optional_child().
bool ng::flg_manager::is_random_faction | ( | ) |
Definition at line 148 of file flg_manager.cpp.
References current_faction_.
Referenced by resolve_random(), ng::side_engine::resolve_random(), and update_available_leaders().
|
inline |
Definition at line 52 of file flg_manager.hpp.
References saved_game_.
Referenced by gui2::dialogs::faction_select::on_faction_select().
|
private |
returns -1 if no leader with that name was found
Definition at line 510 of file flg_manager.cpp.
References choosable_leaders_.
Referenced by current_leader_index(), and set_current_leader().
|
privatedelete |
void ng::flg_manager::resolve_random | ( | randomness::mt_rng & | rng, |
const std::vector< std::string > & | avoid | ||
) |
Definition at line 158 of file flg_manager.cpp.
References _(), available_factions_, available_genders_, available_leaders_, current_faction_, current_gender_, current_leader_, faction_index(), unit_type_data::find(), randomness::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().
|
private |
Definition at line 427 of file flg_manager.cpp.
References choosable_factions_, original_faction_, and set_current_faction().
Referenced by flg_manager().
|
inline |
Definition at line 37 of file flg_manager.hpp.
References faction_index(), and set_current_faction().
void ng::flg_manager::set_current_faction | ( | const std::string & | id | ) |
Definition at line 119 of file flg_manager.cpp.
References choosable_factions_, ERR_MP, utf8::index(), set_current_faction(), and side_num_.
void ng::flg_manager::set_current_faction | ( | const unsigned | index | ) |
Definition at line 110 of file flg_manager.cpp.
References choosable_factions_, current_faction_, utf8::index(), set_current_leader(), and update_available_leaders().
Referenced by gui2::dialogs::faction_select::on_faction_select(), ng::side_engine::place_user(), gui2::dialogs::faction_select::post_show(), ng::side_engine::reset(), select_default_faction(), set_current_faction(), and ng::side_engine::set_faction_commandline().
void ng::flg_manager::set_current_gender | ( | const std::string & | gender | ) |
Definition at line 534 of file flg_manager.cpp.
References ERR_MP, gender_index(), utf8::index(), set_current_gender(), and side_num_.
void ng::flg_manager::set_current_gender | ( | const unsigned | index | ) |
Definition at line 142 of file flg_manager.cpp.
References choosable_genders_, current_gender_, and utf8::index().
Referenced by gui2::dialogs::faction_select::on_gender_select(), ng::side_engine::place_user(), gui2::dialogs::faction_select::post_show(), resolve_random(), set_current_gender(), and set_current_leader().
void ng::flg_manager::set_current_leader | ( | const std::string & | leader | ) |
Definition at line 524 of file flg_manager.cpp.
References ERR_MP, utf8::index(), leader_index(), set_current_leader(), and side_num_.
void ng::flg_manager::set_current_leader | ( | const unsigned | index | ) |
Definition at line 133 of file flg_manager.cpp.
References choosable_leaders_, current_leader_, utf8::index(), set_current_gender(), and update_available_genders().
Referenced by gui2::dialogs::faction_select::on_leader_select(), ng::side_engine::place_user(), gui2::dialogs::faction_select::post_show(), resolve_random(), set_current_faction(), and set_current_leader().
|
private |
Definition at line 263 of file flg_manager.cpp.
References available_factions_, era_factions_, faction_lock_, has_no_recruits_, original_faction_, and update_choosable_factions().
Referenced by flg_manager().
|
private |
Definition at line 339 of file flg_manager.cpp.
References available_genders_, current_leader_, default_leader_gender_, unit_race::FEMALE, unit_type_data::find(), leader_lock_, unit_race::s_female, unit_race::s_male, saved_game_, savegame_gender_, unit_types, and update_choosable_genders().
Referenced by resolve_random(), and set_current_leader().
|
private |
Definition at line 295 of file flg_manager.cpp.
References append_leaders_from_faction(), available_factions_, available_leaders_, current_faction_, default_leader_type_, utils::erase_if(), f, is_random_faction(), leader_lock_, s, saved_game_, and update_choosable_leaders().
Referenced by resolve_random(), and set_current_faction().
|
private |
Definition at line 377 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 410 of file flg_manager.cpp.
References available_genders_, choosable_genders_, default_leader_gender_, and leader_lock_.
Referenced by update_available_genders().
|
private |
Definition at line 391 of file flg_manager.cpp.
References available_leaders_, choosable_leaders_, default_leader_type_, and leader_lock_.
Referenced by update_available_leaders().
|
private |
Definition at line 125 of file flg_manager.hpp.
Referenced by resolve_random(), update_available_factions(), update_available_leaders(), and update_choosable_factions().
|
private |
Definition at line 127 of file flg_manager.hpp.
Referenced by resolve_random(), update_available_genders(), and update_choosable_genders().
|
private |
Definition at line 126 of file flg_manager.hpp.
Referenced by append_leaders_from_faction(), resolve_random(), update_available_leaders(), and update_choosable_leaders().
|
private |
Definition at line 129 of file flg_manager.hpp.
Referenced by choosable_factions(), faction_index(), find_suitable_faction(), select_default_faction(), set_current_faction(), and update_choosable_factions().
|
private |
Definition at line 131 of file flg_manager.hpp.
Referenced by choosable_genders(), gender_index(), set_current_gender(), and update_choosable_genders().
|
private |
Definition at line 130 of file flg_manager.hpp.
Referenced by choosable_leaders(), leader_index(), set_current_leader(), and update_choosable_leaders().
|
private |
Definition at line 117 of file flg_manager.hpp.
Referenced by find_suitable_faction().
|
private |
Definition at line 133 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 135 of file flg_manager.hpp.
Referenced by current_gender(), current_gender_index(), resolve_random(), and set_current_gender().
|
private |
Definition at line 134 of file flg_manager.hpp.
Referenced by current_leader(), current_leader_index(), flg_manager(), resolve_random(), set_current_leader(), and update_available_genders().
|
private |
Definition at line 139 of file flg_manager.hpp.
Referenced by default_leader_cfg(), and flg_manager().
|
private |
Definition at line 138 of file flg_manager.hpp.
Referenced by flg_manager(), update_available_genders(), and update_choosable_genders().
|
private |
Definition at line 137 of file flg_manager.hpp.
Referenced by flg_manager(), update_available_leaders(), and update_choosable_leaders().
|
private |
Definition at line 106 of file flg_manager.hpp.
Referenced by update_available_factions().
|
private |
Definition at line 110 of file flg_manager.hpp.
Referenced by find_suitable_faction().
|
private |
Definition at line 121 of file flg_manager.hpp.
Referenced by flg_manager(), update_available_factions(), and update_choosable_factions().
|
private |
Definition at line 119 of file flg_manager.hpp.
Referenced by update_available_factions().
|
private |
Definition at line 122 of file flg_manager.hpp.
Referenced by flg_manager(), update_available_genders(), update_available_leaders(), update_choosable_genders(), and update_choosable_leaders().
|
private |
Definition at line 115 of file flg_manager.hpp.
Referenced by find_suitable_faction(), select_default_faction(), and update_available_factions().
|
private |
Definition at line 113 of file flg_manager.hpp.
|
private |
Definition at line 116 of file flg_manager.hpp.
Referenced by find_suitable_faction().
|
private |
Definition at line 112 of file flg_manager.hpp.
|
private |
Definition at line 118 of file flg_manager.hpp.
Referenced by is_saved_game(), update_available_genders(), and update_available_leaders().
|
private |
Definition at line 114 of file flg_manager.hpp.
Referenced by flg_manager(), and update_available_genders().
|
private |
Definition at line 109 of file flg_manager.hpp.
Referenced by set_current_faction(), set_current_gender(), and set_current_leader().