Fix probably the oldest bug ever;...

...unit advancement may consider female units' generic profile a
custom one due to a flaw (i.e. happens currently with female Elvish
Archer portraits; they are conserved along the entire unit tree).

This reflects commit of 2008-03-03T14:53:54Z!shadowm@wesnoth.org on the 1.4 branch. Note that
both also prevent the same thing to happen with variation-specific
portraits.  There is no test case for such situation in mainline yet.
This commit is contained in:
Ignacio R. Morelle 2008-03-03 15:37:44 +00:00
parent 2b8ee40b02
commit d77204dfc2

View file

@ -496,12 +496,17 @@ void unit::advance_to(const unit_type* t, bool use_traits, game_state* state)
if(t->movement_type().get_parent()) {
cfg_.merge_with(t->movement_type().get_parent()->get_cfg());
}
// If unit has specific profile, remember it and have it after advaces
// If unit has specific profile, remember it and keep it after advancing
bool specific_profile = false;
std::string profile;
if (type() != NULL)
{
specific_profile = (cfg_["profile"] != type()->cfg_["profile"]);
// Update 2008-02-23 by Shadowmaster: make the test for specific profile take
// into account advancing unit's gender and variation to avoid issues like in Elvish Archer+female, which
// was considering its profile as "specific" when advancing, as it isn't the same as the
// male profile
specific_profile = (cfg_["profile"] != type()->get_gender_unit_type(gender_).get_variation(variation_).cfg_["profile"]);
if (specific_profile)
{
profile = cfg_["profile"];