unit_type Class Reference

#include <unit_types.hpp>

Collaboration diagram for unit_type:

Collaboration graph
[legend]

List of all members.

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_typeget_gender_unit_type (unit_race::GENDER gender) const
const unit_typeget_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_stringtype_name () const
 The name of the unit in the current language setting.
const std::string & id () const
const t_stringunit_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_typeattacks () const
const unit_movement_typemovement_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_listmodification_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_typegender_types_ [2]
variations_map variations_
const unit_racerace_
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::GENDERgenders_
std::vector< unit_animationanimations_
BUILD_STATUS build_status_

Friends

class unit
class unit_type_data

Classes

struct  experience_accelerator


Detailed Description

Definition at line 149 of file unit_types.hpp.


Member Typedef Documentation

typedef std::map<std::string,unit_type*> unit_type::variations_map [private]

Definition at line 271 of file unit_types.hpp.


Member Enumeration Documentation

Enumerator:
LAWFUL 
NEUTRAL 
CHAOTIC 

Definition at line 217 of file unit_types.hpp.

Enumerator:
NOT_BUILT 
HELP_INDEX 
WITHOUT_ANIMATIONS 
FULL 

Definition at line 245 of file unit_types.hpp.


Constructor & Destructor Documentation

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_.


Member Function Documentation

void unit_type::build_full ( const config cfg,
const movement_type_map movement_types,
const race_map races,
const std::vector< config * > &  traits 
)

void unit_type::build_help_index ( const config cfg,
const race_map races 
)

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

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]

const std::string& unit_type::id (  )  const [inline]

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]

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]

const std::string& unit_type::usage (  )  const [inline]

Definition at line 193 of file unit_types.hpp.

References usage_.

const std::string& unit_type::image (  )  const [inline]

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]

std::vector< attack_type > unit_type::attacks (  )  const

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

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]

Definition at line 206 of file unit_types.hpp.

References advances_from_.

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]

const char * unit_type::alignment_id ( unit_type::ALIGNMENT  align  )  [static]

Definition at line 862 of file unit_types.cpp.

Referenced by reports::generate_report().

fixed_t unit_type::alpha (  )  const [inline]

Definition at line 223 of file unit_types.hpp.

References alpha_.

Referenced by unit::advance_to().

const std::vector<std::string>& unit_type::abilities (  )  const [inline]

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]

Definition at line 232 of file unit_types.hpp.

References zoc_.

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]

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]

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]

BUILD_STATUS unit_type::build_status (  )  const [inline]

Definition at line 247 of file unit_types.hpp.

References build_status_.

void unit_type::operator= ( const unit_type o  )  [private]


Friends And Related Function Documentation

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.


Member Data Documentation

std::string unit_type::id_ [private]

Definition at line 253 of file unit_types.hpp.

Referenced by build_help_index(), and id().

Definition at line 254 of file unit_types.hpp.

Referenced by build_help_index(), and type_name().

Definition at line 255 of file unit_types.hpp.

Referenced by build_help_index(), and unit_description().

int unit_type::hitpoints_ [private]

Definition at line 256 of file unit_types.hpp.

Referenced by build_help_index(), and hitpoints().

int unit_type::level_ [private]

Definition at line 257 of file unit_types.hpp.

Referenced by build_help_index(), and level().

int unit_type::movement_ [private]

Definition at line 258 of file unit_types.hpp.

Referenced by build_help_index(), and movement().

int unit_type::cost_ [private]

Definition at line 259 of file unit_types.hpp.

Referenced by build_help_index(), and cost().

std::string unit_type::usage_ [private]

Definition at line 260 of file unit_types.hpp.

Referenced by build_help_index(), and usage().

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]

Definition at line 265 of file unit_types.hpp.

Referenced by build_full(), and flag_rgb().

unsigned int unit_type::num_traits_ [private]

Definition at line 267 of file unit_types.hpp.

Referenced by build_help_index(), and num_traits().

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().

Definition at line 276 of file unit_types.hpp.

Referenced by alpha(), and build_full().

std::vector<std::string> unit_type::abilities_ [private]

Definition at line 278 of file unit_types.hpp.

Referenced by abilities(), and build_help_index().

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]

Definition at line 281 of file unit_types.hpp.

Referenced by build_full(), and has_zoc().

bool unit_type::hide_help_ [private]

Definition at line 281 of file unit_types.hpp.

Referenced by build_help_index(), and hide_help().

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().

Definition at line 285 of file unit_types.hpp.

Referenced by add_advancement(), build_full(), and experience_needed().

Definition at line 288 of file unit_types.hpp.

Referenced by alignment(), and build_full().

Definition at line 290 of file unit_types.hpp.

Referenced by build_full(), and movement_type().

Definition at line 292 of file unit_types.hpp.

Referenced by build_full(), and possible_traits().

std::vector<unit_race::GENDER> unit_type::genders_ [private]

Definition at line 294 of file unit_types.hpp.

Referenced by build_help_index(), and genders().

std::vector<unit_animation> unit_type::animations_ [mutable, private]

Definition at line 297 of file unit_types.hpp.

Referenced by animations().

Definition at line 299 of file unit_types.hpp.

Referenced by build_full(), build_help_index(), build_status(), and unit_type().


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

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs