Fixes bug #13176...

...(advancefrom tag ignores experience requirement) and removes some
no longer needed debug messages.
This commit is contained in:
Jörg Hinrichs 2009-03-12 21:38:29 +00:00
parent 5e0213f413
commit 1359edf0ae
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
Version 1.5.13+svn: Version 1.5.13+svn:
* Graphics: * Graphics:
* New portrait for the female Assassin, Gryphon Rider, longbowman. * New portrait for the female Assassin, Gryphon Rider, longbowman.
* Language and i18n: * Language and i18n:
@ -11,6 +11,7 @@ Version 1.5.13+svn:
* Fixed bug #13161: Inactive weapon special name and description not used * Fixed bug #13161: Inactive weapon special name and description not used
* Miscellaneous and bug fixes: * Miscellaneous and bug fixes:
* Fix another campaign replay bug (#13139) * Fix another campaign replay bug (#13139)
* Fix WML [advancefrom] bug (#13176)
Version 1.5.13: Version 1.5.13:
* Graphics: * Graphics:

View File

@ -574,7 +574,6 @@ unit_type::unit_type() :
build_status_(NOT_BUILT), build_status_(NOT_BUILT),
portraits_() portraits_()
{ {
DBG_UT << "unit_type default constructor\n";
gender_types_[0] = NULL; gender_types_[0] = NULL;
gender_types_[1] = NULL; gender_types_[1] = NULL;
} }
@ -615,7 +614,6 @@ unit_type::unit_type(const unit_type& o) :
build_status_(o.build_status_), build_status_(o.build_status_),
portraits_(o.portraits_) portraits_(o.portraits_)
{ {
DBG_UT << "unit_type copy-constructor\n";
gender_types_[0] = o.gender_types_[0] != NULL ? new unit_type(*o.gender_types_[0]) : NULL; gender_types_[0] = o.gender_types_[0] != NULL ? new unit_type(*o.gender_types_[0]) : NULL;
gender_types_[1] = o.gender_types_[1] != NULL ? new unit_type(*o.gender_types_[1]) : NULL; gender_types_[1] = o.gender_types_[1] != NULL ? new unit_type(*o.gender_types_[1]) : NULL;
@ -663,13 +661,11 @@ unit_type::unit_type(const config& cfg, const movement_type_map& mv_types,
build_status_(NOT_BUILT), build_status_(NOT_BUILT),
portraits_() portraits_()
{ {
DBG_UT << "unit_type constructor cfg, mv_types, races, traits\n";
build_full(cfg, mv_types, races, traits); build_full(cfg, mv_types, races, traits);
} }
unit_type::~unit_type() unit_type::~unit_type()
{ {
DBG_UT << "unit_type destructor\n";
if (gender_types_[unit_race::MALE] != NULL) if (gender_types_[unit_race::MALE] != NULL)
delete gender_types_[unit_race::MALE]; delete gender_types_[unit_race::MALE];
if (gender_types_[unit_race::FEMALE] != NULL) if (gender_types_[unit_race::FEMALE] != NULL)
@ -776,8 +772,6 @@ void unit_type::build_full(const config& cfg, const movement_type_map& mv_types,
DBG_UT << "no parent found for movement_type " << move_type << "\n"; DBG_UT << "no parent found for movement_type " << move_type << "\n";
} }
experience_needed_=lexical_cast_default<int>(cfg["experience"],500);
flag_rgb_ = cfg["flag_rgb"]; flag_rgb_ = cfg["flag_rgb"];
game_config::add_color_info(cfg); game_config::add_color_info(cfg);
@ -920,6 +914,8 @@ void unit_type::build_created(const config& cfg, const movement_type_map& mv_typ
advances_to_ = utils::split(advances_to_val); advances_to_ = utils::split(advances_to_val);
DBG_UT << "unit_type '" << id_ << "' advances to : " << advances_to_val << "\n"; DBG_UT << "unit_type '" << id_ << "' advances to : " << advances_to_val << "\n";
experience_needed_=lexical_cast_default<int>(cfg["experience"],500);
build_status_ = CREATED; build_status_ = CREATED;
} }
@ -1103,7 +1099,10 @@ void unit_type::add_advancement(const unit_type &to_unit,int xp)
return; return;
} }
if(xp>0 && experience_needed_>xp) experience_needed_=xp; if( xp > 0 && experience_needed_ > xp){
DBG_UT << "Lowering experience_needed from " << experience_needed_ << " to " << xp << " due to [advancefrom] of " << to_id << "\n";
experience_needed_ = xp;
}
// Add advancements to gendered subtypes, if supported by to_unit // Add advancements to gendered subtypes, if supported by to_unit
for(int gender=0; gender<=1; ++gender) { for(int gender=0; gender<=1; ++gender) {