Author: ai0867
Date: Thu Oct 13 17:04:27 2011
New Revision: 51463

URL: http://svn.gna.org/viewcvs/wesnoth?rev=51463&view=rev
Log:
Make the create unit dialog use valid genders for the unit type (bug #18704)

Modified:
    trunk/changelog
    trunk/src/menu_events.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=51463&r1=51462&r2=51463&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Thu Oct 13 17:04:27 2011
@@ -52,6 +52,8 @@
    * Made it possible to switch themes from Preferences in the main menu
      (bug #10969)
    * Fixed preload event not being fired (bug #18695)
+   * Make the create unit dialog give the created unit a valid gender for
+     that unit type. (bug #18704)
 
 Version 1.9.9:
  * AI:

Modified: trunk/src/menu_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/menu_events.cpp?rev=51463&r1=51462&r2=51463&view=diff
==============================================================================
--- trunk/src/menu_events.cpp (original)
+++ trunk/src/menu_events.cpp Thu Oct 13 17:04:27 2011
@@ -1586,9 +1586,11 @@
                last_selection = choice;
                random_gender  = random_gender_choice;
 
-               const unit_race::GENDER gender = random_gender ? 
unit_race::NUM_GENDERS : unit_race::MALE;
-
-               unit chosen(unit_choices[choice], 1, true, gender);
+               const unit_type* type = unit_choices[choice];
+               const unit_race::GENDER gender = random_gender ? 
unit_race::NUM_GENDERS :
+                       type->genders().empty() ? unit_race::MALE : 
type->genders().front();
+
+               unit chosen(type, 1, true, gender);
                chosen.new_turn();
 
                const map_location& loc = mousehandler.get_last_hex();


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to