Address bug #11197...

...([unit] spawning of Elvish Druid et al doesn't set genders properly).  

This fix should be backported to 1.4.
This commit is contained in:
Eric S. Raymond 2008-03-04 20:18:29 +00:00
parent 3037f497d5
commit 528184fb3a
2 changed files with 4 additions and 3 deletions

View file

@ -9,10 +9,11 @@ Version 1.5.0-svn:
movetypes. Note! This will create compatibility issues with UMC
that relies on a grassland= in a movetype or [defense] tag to also
set stats for roads.
* miscellaneous and bug fixes:
* remove an ancient wml update program which has been obsoleted by wmllint
* added the boost regex dependency
* added the sdl-ttf dependency
* default gender selection now works correctly for units with
only a female variant. Fixes bug #11197.
Version 1.4:
* language and i18n:

View file

@ -1174,7 +1174,7 @@ void unit::read(const config& cfg, bool use_traits, game_state* state)
max_experience_ = lexical_cast_default<int>(cfg["max_experience"]);
/* */
if(utils::string_bool(cfg_["random_gender"], false)) {
if(cfg["gender"].empty()) {
const game_data::unit_type_map::const_iterator ut = gamedata_->unit_types.find(cfg["type"]);
//! @todo FIXME shadowmaster: in my opinion, the following condition check
//! should be done earlier in this function as it is repated later for other
@ -1184,7 +1184,7 @@ void unit::read(const config& cfg, bool use_traits, game_state* state)
//! the config obj. Not sure if that would be wanted; can the engine handle units
//! that don't have an equivalent unit_type obj associated?
if (ut != gamedata_->unit_types.end())
gender_ = generate_gender(ut->second, true, state);
gender_ = generate_gender(ut->second, utils::string_bool(cfg_["random_gender"], false), state);
else
ERR_UT << "no valid unit_type found for unit WML id \"" << cfg["type"] << "\"!\n";
} else {