#include <unit_types.hpp>
Public Types | |
enum | ALIGNMENT { LAWFUL, NEUTRAL, CHAOTIC } |
enum | BUILD_STATUS { NOT_BUILT, HELP_INDEX, WITHOUT_ANIMATIONS, FULL } |
Public Member Functions | |
unit_type () | |
unit_type (const config &cfg, const movement_type_map &movement_types, const race_map &races, const std::vector< config * > &traits) | |
unit_type (const unit_type &o) | |
~unit_type () | |
void | build_full (const config &cfg, const movement_type_map &movement_types, const race_map &races, const std::vector< config * > &traits) |
Load data into an empty unit_type. | |
void | build_help_index (const config &cfg, const race_map &races) |
Partially load data into an empty unit_type. | |
void | add_advancement (const unit_type &advance_to, int experience) |
Adds an additional advancement path to a unit type. | |
void | add_advancesfrom (std::string unit_id) |
Adds units that this unit advances from, for help file purposes. | |
const unit_type & | get_gender_unit_type (unit_race::GENDER gender) const |
const unit_type & | get_variation (const std::string &name) const |
const std::string & | undead_variation () const |
Info on the type of unit that the unit reanimates as. | |
unsigned int | num_traits () const |
const t_string & | type_name () const |
The name of the unit in the current language setting. | |
const std::string & | id () const |
const t_string & | unit_description () const |
int | hitpoints () const |
int | level () const |
int | movement () const |
int | cost () const |
const std::string & | usage () const |
const std::string & | image () const |
const std::string & | image_profile () const |
const std::vector < unit_animation > & | animations () const |
const std::string & | flag_rgb () const |
std::vector< attack_type > | attacks () const |
const unit_movement_type & | movement_type () const |
int | experience_needed (bool with_acceleration=true) const |
std::vector< std::string > | advances_to () const |
std::vector< std::string > | advances_from () const |
const config::child_list & | modification_advancements () const |
ALIGNMENT | alignment () const |
fixed_t | alpha () const |
const std::vector< std::string > & | abilities () const |
const std::vector< std::string > & | ability_tooltips () const |
bool | can_advance () const |
bool | not_living () const |
bool | has_zoc () const |
bool | has_ability (const std::string &ability) const |
bool | has_ability_by_id (const std::string &ability) const |
const std::vector< config * > | possible_traits () const |
bool | has_random_traits () const |
const std::vector < unit_race::GENDER > & | genders () const |
const std::string & | race () const |
bool | hide_help () const |
BUILD_STATUS | build_status () const |
Static Public Member Functions | |
static const char * | alignment_description (ALIGNMENT align) |
static const char * | alignment_id (ALIGNMENT align) |
Private Types | |
typedef std::map< std::string, unit_type * > | variations_map |
Private Member Functions | |
void | operator= (const unit_type &o) |
Private Attributes | |
config | cfg_ |
std::string | id_ |
t_string | type_name_ |
t_string | description_ |
int | hitpoints_ |
int | level_ |
int | movement_ |
int | cost_ |
std::string | usage_ |
std::string | undead_variation_ |
std::string | image_ |
std::string | image_profile_ |
std::string | flag_rgb_ |
unsigned int | num_traits_ |
unit_type * | gender_types_ [2] |
variations_map | variations_ |
const unit_race * | race_ |
fixed_t | alpha_ |
std::vector< std::string > | abilities_ |
std::vector< std::string > | ability_tooltips_ |
bool | zoc_ |
bool | hide_help_ |
std::vector< std::string > | advances_to_ |
std::vector< std::string > | advances_from_ |
int | experience_needed_ |
ALIGNMENT | alignment_ |
unit_movement_type | movementType_ |
config | possibleTraits_ |
std::vector< unit_race::GENDER > | genders_ |
std::vector< unit_animation > | animations_ |
BUILD_STATUS | build_status_ |
Friends | |
class | unit |
class | unit_type_data |
Classes | |
struct | experience_accelerator |
Definition at line 149 of file unit_types.hpp.
typedef std::map<std::string,unit_type*> unit_type::variations_map [private] |
Definition at line 271 of file unit_types.hpp.
enum unit_type::ALIGNMENT |
Definition at line 245 of file unit_types.hpp.
unit_type::unit_type | ( | ) |
Definition at line 524 of file unit_types.cpp.
References build_status_, DBG_UT, gender_types_, and NOT_BUILT.
Referenced by build_full(), and unit_type().
unit_type::unit_type | ( | const config & | cfg, | |
const movement_type_map & | movement_types, | |||
const race_map & | races, | |||
const std::vector< config * > & | traits | |||
) |
Definition at line 555 of file unit_types.cpp.
References build_full(), build_status_, DBG_UT, and NOT_BUILT.
unit_type::unit_type | ( | const unit_type & | o | ) |
Definition at line 532 of file unit_types.cpp.
References build_status_, DBG_UT, gender_types_, unit_type(), and variations_.
unit_type::~unit_type | ( | ) |
Definition at line 563 of file unit_types.cpp.
References DBG_UT, unit_race::FEMALE, gender_types_, unit_race::MALE, and variations_.
void unit_type::build_full | ( | const config & | cfg, | |
const movement_type_map & | movement_types, | |||
const race_map & | races, | |||
const std::vector< config * > & | traits | |||
) |
Load data into an empty unit_type.
Definition at line 574 of file unit_types.cpp.
References config::add_child(), game_config::add_color_info(), unit_race::additional_traits(), advances_to_, alignment_, alpha_, build_help_index(), build_status_, CHAOTIC, config::child(), config::clear(), config::clear_children(), DBG_UT, lg::err, experience_needed_, unit_race::FEMALE, flag_rgb_, ftofxp, FULL, gender_types_, config::get_children(), id(), LAWFUL, LOG_STREAM, unit_race::MALE, config::merge_with(), movementType_, NEUTRAL, NOT_BUILT, possibleTraits_, race_, unit_movement_type::set_parent(), utils::split(), utils::string_bool(), unit_type(), unit_race::uses_global_traits(), variations_, and zoc_.
Referenced by unit_type().
Partially load data into an empty unit_type.
Definition at line 716 of file unit_types.cpp.
References abilities_, ability_tooltips_, config::all_children(), build_status_, cfg_, config::child(), cost_, description_, g, genders(), genders_, HELP_INDEX, hide_help_, hitpoints_, id_, image_, image_profile_, level_, unit_race::MALE, movement_, num_traits_, race_, utils::split(), utils::string_bool(), string_gender(), type_name_, undead_variation_, and usage_.
Referenced by build_full().
void unit_type::add_advancement | ( | const unit_type & | advance_to, | |
int | experience | |||
) |
Adds an additional advancement path to a unit type.
This is used to implement the [advancefrom] tag.
Definition at line 910 of file unit_types.cpp.
References add_advancement(), advances_to_, cfg_, lg::config, experience_needed_, gender_types_, lg::info, variations_, and lg::warn.
Referenced by add_advancement().
void unit_type::add_advancesfrom | ( | std::string | unit_id | ) |
Adds units that this unit advances from, for help file purposes.
Definition at line 903 of file unit_types.cpp.
References advances_from_.
Referenced by unit_type_data::unit_type_map_wrapper::add_advancement().
const unit_type & unit_type::get_gender_unit_type | ( | unit_race::GENDER | gender | ) | const |
Definition at line 767 of file unit_types.cpp.
References gender_types_.
Referenced by unit::advance_to(), mp::wait::leader_preview_pane::draw_contents(), mp::wait::generate_menu(), unit::unit(), leader_list_manager::update_gender_list(), and unit::write().
const unit_type & unit_type::get_variation | ( | const std::string & | name | ) | const |
Definition at line 777 of file unit_types.cpp.
References variations_.
Referenced by unit::advance_to(), and unit::write().
const std::string& unit_type::undead_variation | ( | ) | const [inline] |
Info on the type of unit that the unit reanimates as.
Definition at line 180 of file unit_types.hpp.
References undead_variation_.
Referenced by unit::advance_to().
unsigned int unit_type::num_traits | ( | ) | const [inline] |
Definition at line 182 of file unit_types.hpp.
References unit_race::num_traits(), num_traits_, and race_.
Referenced by has_random_traits().
const t_string& unit_type::type_name | ( | ) | const [inline] |
The name of the unit in the current language setting.
Definition at line 185 of file unit_types.hpp.
References type_name_.
Referenced by unit::advance_to(), mp::wait::leader_preview_pane::draw_contents(), help::generate_ability_topics(), mp::wait::generate_menu(), help::generate_unit_topics(), help::generate_weapon_special_topics(), dialogs::unit_types_preview_pane::get_details(), leader_list_manager::populate_leader_combo(), and events::menu_handler::recruit().
const std::string& unit_type::id | ( | ) | const [inline] |
Definition at line 187 of file unit_types.hpp.
References id_.
Referenced by unit::advance_to(), ai::average_resistance_against(), build_full(), ai::compare_unit_types(), help::description_type(), help::generate_ability_topics(), help::generate_unit_topics(), help::generate_weapon_special_topics(), dialogs::unit_types_preview_pane::get_details(), not_living(), unit::set_underlying_id(), and dialogs::show_unit_description().
const t_string & unit_type::unit_description | ( | ) | const |
Definition at line 795 of file unit_types.cpp.
References description_, and t_string::empty().
Referenced by unit::advance_to(), and unit::write().
int unit_type::hitpoints | ( | ) | const [inline] |
Definition at line 189 of file unit_types.hpp.
References hitpoints_.
Referenced by unit::advance_to(), ai::average_resistance_against(), and dialogs::unit_types_preview_pane::get_details().
int unit_type::level | ( | ) | const [inline] |
Definition at line 190 of file unit_types.hpp.
References level_.
Referenced by unit::advance_to(), and dialogs::unit_types_preview_pane::get_details().
int unit_type::movement | ( | ) | const [inline] |
Definition at line 191 of file unit_types.hpp.
References movement_.
Referenced by unit::advance_to(), and dialogs::unit_types_preview_pane::get_details().
int unit_type::cost | ( | ) | const [inline] |
Definition at line 192 of file unit_types.hpp.
References cost_.
Referenced by unit::advance_to(), events::menu_handler::recruit(), events::menu_handler::redo(), and events::menu_handler::undo().
const std::string& unit_type::usage | ( | ) | const [inline] |
const std::string& unit_type::image | ( | ) | const [inline] |
Definition at line 194 of file unit_types.hpp.
References image_.
Referenced by mp::wait::leader_preview_pane::draw_contents(), mp::wait::generate_menu(), dialogs::unit_types_preview_pane::get_details(), help::unit_topic_generator::operator()(), leader_list_manager::populate_leader_combo(), events::menu_handler::recruit(), and leader_list_manager::update_gender_list().
const std::string & unit_type::image_profile | ( | ) | const |
Definition at line 787 of file unit_types.cpp.
References image_, and image_profile_.
Referenced by help::unit_topic_generator::operator()().
const std::vector< unit_animation > & unit_type::animations | ( | ) | const |
Definition at line 805 of file unit_types.cpp.
References animations_, cfg_, and unit_animation::fill_initial_animations().
Referenced by unit::advance_to().
const std::string& unit_type::flag_rgb | ( | ) | const [inline] |
Definition at line 199 of file unit_types.hpp.
References flag_rgb_.
Referenced by unit::advance_to(), mp::wait::leader_preview_pane::draw_contents(), mp::wait::generate_menu(), dialogs::unit_types_preview_pane::get_details(), help::unit_topic_generator::operator()(), leader_list_manager::populate_leader_combo(), events::menu_handler::recruit(), and leader_list_manager::update_gender_list().
std::vector< attack_type > unit_type::attacks | ( | ) | const |
Definition at line 813 of file unit_types.cpp.
References cfg_, and config::child_range().
Referenced by unit::advance_to(), ai::average_resistance_against(), help::generate_weapon_special_topics(), and dialogs::unit_types_preview_pane::get_details().
const unit_movement_type& unit_type::movement_type | ( | ) | const [inline] |
Definition at line 202 of file unit_types.hpp.
References movementType_.
Referenced by unit::advance_to(), and ai::average_resistance_against().
int unit_type::experience_needed | ( | bool | with_acceleration = true |
) | const |
Definition at line 844 of file unit_types.cpp.
References experience_modifier, and experience_needed_.
Referenced by unit::advance_to(), and dialogs::unit_types_preview_pane::get_details().
std::vector<std::string> unit_type::advances_to | ( | ) | const [inline] |
Definition at line 205 of file unit_types.hpp.
References advances_to_.
Referenced by unit::advance_to().
std::vector<std::string> unit_type::advances_from | ( | ) | const [inline] |
const config::child_list& unit_type::modification_advancements | ( | ) | const [inline] |
Definition at line 207 of file unit_types.hpp.
References cfg_, and config::get_children().
Referenced by dialogs::unit_types_preview_pane::get_details().
ALIGNMENT unit_type::alignment | ( | ) | const [inline] |
Definition at line 219 of file unit_types.hpp.
References alignment_.
Referenced by unit::advance_to(), and dialogs::unit_types_preview_pane::get_details().
const char * unit_type::alignment_description | ( | unit_type::ALIGNMENT | align | ) | [static] |
Definition at line 856 of file unit_types.cpp.
References N_.
Referenced by reports::generate_report(), dialogs::unit_types_preview_pane::get_details(), and dialogs::units_list_preview_pane::get_details().
const char * unit_type::alignment_id | ( | unit_type::ALIGNMENT | align | ) | [static] |
fixed_t unit_type::alpha | ( | ) | const [inline] |
const std::vector<std::string>& unit_type::abilities | ( | ) | const [inline] |
Definition at line 225 of file unit_types.hpp.
References abilities_.
Referenced by help::generate_ability_topics(), and dialogs::unit_types_preview_pane::get_details().
const std::vector<std::string>& unit_type::ability_tooltips | ( | ) | const [inline] |
Definition at line 226 of file unit_types.hpp.
References ability_tooltips_.
Referenced by help::generate_ability_topics().
bool unit_type::can_advance | ( | ) | const [inline] |
Definition at line 228 of file unit_types.hpp.
References advances_to_.
Referenced by dialogs::unit_types_preview_pane::get_details().
bool unit_type::not_living | ( | ) | const |
Definition at line 1160 of file unit_types.cpp.
References id(), possible_traits(), and utils::split().
Referenced by ai::average_resistance_against().
bool unit_type::has_zoc | ( | ) | const [inline] |
bool unit_type::has_ability | ( | const std::string & | ability | ) | const |
Definition at line 868 of file unit_types.cpp.
References cfg_, config::child(), and config::get_children().
bool unit_type::has_ability_by_id | ( | const std::string & | ability | ) | const |
Definition at line 876 of file unit_types.cpp.
References config::all_children(), cfg_, and config::child().
Referenced by ai::average_resistance_against().
const std::vector<config*> unit_type::possible_traits | ( | ) | const [inline] |
Definition at line 237 of file unit_types.hpp.
References config::get_children(), and possibleTraits_.
Referenced by dialogs::unit_types_preview_pane::get_details(), has_random_traits(), and not_living().
bool unit_type::has_random_traits | ( | ) | const [inline] |
Definition at line 238 of file unit_types.hpp.
References num_traits(), possible_traits(), and size.
const std::vector<unit_race::GENDER>& unit_type::genders | ( | ) | const [inline] |
Definition at line 240 of file unit_types.hpp.
References genders_.
Referenced by build_help_index(), unit::generate_gender(), dialogs::unit_types_preview_pane::get_details(), and leader_list_manager::update_gender_list().
const std::string & unit_type::race | ( | ) | const |
Definition at line 892 of file unit_types.cpp.
References empty_string, unit_race::id(), and race_.
Referenced by help::generate_races_sections(), and help::generate_unit_topics().
bool unit_type::hide_help | ( | ) | const [inline] |
Definition at line 243 of file unit_types.hpp.
References hide_help_.
Referenced by help::generate_ability_topics(), help::generate_races_sections(), help::generate_unit_topics(), help::generate_weapon_special_topics(), and dialogs::show_unit_description().
BUILD_STATUS unit_type::build_status | ( | ) | const [inline] |
void unit_type::operator= | ( | const unit_type & | o | ) | [private] |
friend class unit [friend] |
Definition at line 152 of file unit_types.hpp.
friend class unit_type_data [friend] |
Definition at line 153 of file unit_types.hpp.
config unit_type::cfg_ [private] |
Definition at line 251 of file unit_types.hpp.
Referenced by add_advancement(), unit::advance_to(), animations(), attacks(), build_help_index(), has_ability(), has_ability_by_id(), and modification_advancements().
std::string unit_type::id_ [private] |
t_string unit_type::type_name_ [private] |
t_string unit_type::description_ [private] |
Definition at line 255 of file unit_types.hpp.
Referenced by build_help_index(), and unit_description().
int unit_type::hitpoints_ [private] |
int unit_type::level_ [private] |
int unit_type::movement_ [private] |
int unit_type::cost_ [private] |
std::string unit_type::usage_ [private] |
std::string unit_type::undead_variation_ [private] |
Definition at line 261 of file unit_types.hpp.
Referenced by build_help_index(), and undead_variation().
std::string unit_type::image_ [private] |
Definition at line 263 of file unit_types.hpp.
Referenced by build_help_index(), image(), and image_profile().
std::string unit_type::image_profile_ [private] |
Definition at line 264 of file unit_types.hpp.
Referenced by build_help_index(), and image_profile().
std::string unit_type::flag_rgb_ [private] |
unsigned int unit_type::num_traits_ [private] |
unit_type* unit_type::gender_types_[2] [private] |
Definition at line 269 of file unit_types.hpp.
Referenced by add_advancement(), build_full(), get_gender_unit_type(), unit_type(), and ~unit_type().
variations_map unit_type::variations_ [private] |
Definition at line 272 of file unit_types.hpp.
Referenced by add_advancement(), build_full(), get_variation(), unit_type(), and ~unit_type().
const unit_race* unit_type::race_ [private] |
Definition at line 274 of file unit_types.hpp.
Referenced by unit::advance_to(), build_full(), build_help_index(), num_traits(), and race().
fixed_t unit_type::alpha_ [private] |
std::vector<std::string> unit_type::abilities_ [private] |
std::vector<std::string> unit_type::ability_tooltips_ [private] |
Definition at line 279 of file unit_types.hpp.
Referenced by ability_tooltips(), and build_help_index().
bool unit_type::zoc_ [private] |
bool unit_type::hide_help_ [private] |
std::vector<std::string> unit_type::advances_to_ [private] |
Definition at line 283 of file unit_types.hpp.
Referenced by add_advancement(), advances_to(), build_full(), and can_advance().
std::vector<std::string> unit_type::advances_from_ [private] |
Definition at line 284 of file unit_types.hpp.
Referenced by add_advancesfrom(), and advances_from().
int unit_type::experience_needed_ [private] |
Definition at line 285 of file unit_types.hpp.
Referenced by add_advancement(), build_full(), and experience_needed().
ALIGNMENT unit_type::alignment_ [private] |
unit_movement_type unit_type::movementType_ [private] |
config unit_type::possibleTraits_ [private] |
std::vector<unit_race::GENDER> unit_type::genders_ [private] |
std::vector<unit_animation> unit_type::animations_ [mutable, private] |
BUILD_STATUS unit_type::build_status_ [private] |
Definition at line 299 of file unit_types.hpp.
Referenced by build_full(), build_help_index(), build_status(), and unit_type().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |