#include <types.hpp>
Public Types | |
typedef std::map< std::string, unit_type > | unit_type_map |
Public Member Functions | |
unit_type_data () | |
const unit_type_map & | types () const |
const race_map & | races () const |
const config::const_child_itors | traits () const |
void | set_config (config &cfg) |
Resets all data based on the provided config. More... | |
const unit_type * | find (const std::string &key, unit_type::BUILD_STATUS status=unit_type::FULL) const |
Finds a unit_type by its id() and makes sure it is built to the specified level. More... | |
void | check_types (const std::vector< std::string > &types) const |
const unit_race * | find_race (const std::string &) const |
void | build_all (unit_type::BUILD_STATUS status) |
Makes sure the all unit_types are built to the specified level. More... | |
void | build_unit_type (const unit_type &ut, unit_type::BUILD_STATUS status) const |
Makes sure the provided unit_type is built to the specified level. More... | |
bool | hide_help (const std::string &type_id, const std::string &race_id) const |
Checks if the [hide_help] tag contains these IDs. More... | |
Private Member Functions | |
void | read_hide_help (const config &cfg) |
Parses the [hide_help] tag. More... | |
std::pair < unit_type_map::iterator, bool > | insert (const std::pair< std::string, unit_type > &utype) |
void | clear () |
void | add_advancefrom (const config &unit_cfg) const |
void | add_advancement (unit_type &to_unit) const |
Private Attributes | |
unit_type_map | types_ |
movement_type_map | movement_types_ |
race_map | races_ |
bool | hide_help_all_ |
True if [hide_help] contains a 'all=yes' at its root. More... | |
std::vector< std::set < std::string > > | hide_help_type_ |
std::vector< std::set < std::string > > | hide_help_race_ |
const config * | unit_cfg_ |
unit_type::BUILD_STATUS | build_status_ |
typedef std::map<std::string,unit_type> unit_type_data::unit_type_map |
Definition at line 1261 of file types.cpp.
References config::child_range(), DBG_UT, error(), unit_type::get_cfg(), unit_type::log_id(), game_logic::msg(), and types_.
Referenced by build_all().
void unit_type_data::build_all | ( | unit_type::BUILD_STATUS | status | ) |
Makes sure the all unit_types are built to the specified level.
Definition at line 1196 of file types.cpp.
References add_advancement(), build_status_, build_unit_type(), unit_type::CREATED, gui2::tloadscreen::progress(), types_, and unit_cfg_.
Referenced by unit_type::advances_from(), ai::formula_ai::get_value(), set_config(), and help::show_help().
|
inline |
Makes sure the provided unit_type is built to the specified level.
Definition at line 326 of file types.hpp.
References unit_type::build(), config::child_range(), movement_types_, races_, and unit_cfg_.
Referenced by unit_type::add_advancement(), BOOST_AUTO_TEST_CASE(), build_all(), find(), dialogs::unit_types_preview_pane::get_details(), help::unit_topic_generator::operator()(), and gui2::tunit_create::pre_show().
void unit_type_data::check_types | ( | const std::vector< std::string > & | types | ) | const |
Definition at line 1177 of file types.cpp.
References find().
Referenced by unit::set_advances_to(), and unit::set_recruits().
|
private |
Definition at line 1184 of file types.cpp.
References build_status_, hide_help_all_, hide_help_race_, hide_help_type_, movement_types_, unit_type::NOT_BUILT, races_, and types_.
Referenced by set_config().
const unit_type * unit_type_data::find | ( | const std::string & | key, |
unit_type::BUILD_STATUS | status = unit_type::FULL |
||
) | const |
Finds a unit_type by its id() and makes sure it is built to the specified level.
Definition at line 1155 of file types.cpp.
References build_unit_type(), DBG_CF, itor, and types_.
Referenced by advancement_tree_internal(), unit::advances_to_translated(), unit::apply_builtin_effect(), check_types(), ai::default_recruitment::recruitment::compare_unit_types(), actions::undo_list::create_action(), wb::recruit::create_corresponding_unit(), ai::default_recruitment::recruitment::do_combat_analysis(), events::console_handler::do_create(), ai::recruit_result::do_execute(), events::menu_handler::do_recruit(), ai::default_recruitment::recruitment::do_similarity_penalty(), mp::wait::leader_preview_pane::draw_contents(), ai::default_recruitment::recruitment::execute(), ng::flg_manager::flg_manager(), help::generate_faction_topics(), mp::wait::generate_menu(), get_advanced_unit(), ai::default_recruitment::recruitment::get_appropriate_recall(), ai::default_recruitment::recruitment::get_average_defense(), ai::default_recruitment::recruitment::get_cheapest_unit_cost_for_leader(), ai::default_recruitment::recruitment::get_cost_map_of_side(), get_unit_type(), ai::recruit_result::get_unit_type_known(), ai::formula_ai::get_value(), ai::helper_advance_unit(), impl_unit_type_get(), basic_unit_filter_impl::internal_matches_filter(), intf_add_known_unit(), game_lua_kernel::intf_find_cost_map(), intf_transform_unit(), help::make_unit_link(), team::minimum_recruit_price(), help::unit_topic_generator::operator()(), wb::recruit::recruit(), events::menu_handler::recruit(), ai::default_recruitment::recruitment::recruit_matches_type(), ng::flg_manager::reset_gender_combo(), ng::flg_manager::reset_leader_combo(), ng::flg_manager::resolve_random(), help::show_unit_description(), statistics::sum_cost_str_int_map(), SYNCED_COMMAND_HANDLER_FUNCTION(), editor::mouse_action_unit::up_left(), ng::flg_manager::update_available_genders(), and ai::default_recruitment::recruitment::update_average_local_cost().
const unit_race * unit_type_data::find_race | ( | const std::string & | key | ) | const |
Definition at line 1286 of file types.cpp.
Referenced by help::generate_faction_topics(), help::generate_races_sections(), help::generate_unit_topics(), impl_race_get(), and unit::unit().
bool unit_type_data::hide_help | ( | const std::string & | type_id, |
const std::string & | race_id | ||
) | const |
Checks if the [hide_help] tag contains these IDs.
Definition at line 1246 of file types.cpp.
References hide_help_all_, hide_help_race_, and hide_help_type_.
Referenced by unit_type::hide_help(), and set_config().
|
inlineprivate |
|
inline |
Definition at line 314 of file types.hpp.
References races_.
Referenced by luaW_pushracetable(), read_hide_help(), and editor::unit_palette::setup().
Parses the [hide_help] tag.
Definition at line 1218 of file types.cpp.
References config::child(), hide_help_race_, hide_help_type_, races(), utils::split(), and types_.
Referenced by set_config().
Resets all data based on the provided config.
This includes some processing of the config, such as expanding base units. A pointer to the config is stored, so the config must be persistent.
Definition at line 1005 of file types.cpp.
References config::attribute_range(), build_all(), config::child(), config::child_range(), clear(), unit_type::CREATED, DBG_UT, ERR_CF, config::has_attribute(), config::has_child(), hide_help(), hide_help_all_, unit_race::id(), lg::info(), insert(), LOG_CONFIG, movement_types_, gui2::tloadscreen::progress(), font::race, races_, read_hide_help(), gui2::terrain, unit_cfg_, and unit_type().
Referenced by test_utils::game_config_manager::game_config_manager(), and game_config_manager::set_unit_data().
|
inline |
Definition at line 315 of file types.hpp.
References config::child_range(), and unit_cfg_.
Referenced by impl_race_get(), and intf_get_traits().
|
inline |
Definition at line 313 of file types.hpp.
References types_.
Referenced by unit_type::advances_from(), events::console_handler::do_discover(), help::generate_ability_topics(), help::generate_races_sections(), help::generate_unit_sections(), help::generate_unit_topics(), help::generate_weapon_special_topics(), game_lua_kernel::initialize(), gui2::tunit_create::pre_show(), and editor::unit_palette::setup().
|
private |
Definition at line 353 of file types.hpp.
Referenced by build_all(), and clear().
|
private |
True if [hide_help] contains a 'all=yes' at its root.
Definition at line 347 of file types.hpp.
Referenced by clear(), hide_help(), and set_config().
|
private |
Definition at line 350 of file types.hpp.
Referenced by clear(), hide_help(), and read_hide_help().
|
private |
Definition at line 349 of file types.hpp.
Referenced by clear(), hide_help(), and read_hide_help().
|
private |
Definition at line 343 of file types.hpp.
Referenced by build_unit_type(), clear(), and set_config().
|
private |
Definition at line 344 of file types.hpp.
Referenced by build_unit_type(), clear(), find_race(), races(), and set_config().
|
mutableprivate |
Definition at line 342 of file types.hpp.
Referenced by add_advancement(), build_all(), clear(), find(), insert(), read_hide_help(), and types().
|
private |
Definition at line 352 of file types.hpp.
Referenced by build_all(), build_unit_type(), set_config(), and traits().