Author: jamit
Date: Sat Mar  9 22:17:16 2013
New Revision: 56464

URL: http://svn.gna.org/viewcvs/wesnoth?rev=56464&view=rev
Log:
Find the base unit type before applying a variation [effect].

Fixes bug #20604.

Modified:
    trunk/src/unit.cpp

Modified: trunk/src/unit.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=56464&r1=56463&r2=56464&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Sat Mar  9 22:17:16 2013
@@ -2637,7 +2637,9 @@
        if (!last_effect.empty() && no_add == false) {
                if ((last_effect)["apply_to"] == "variation") {
                        variation_ = last_effect["name"].str();
-                       advance_to(type());
+                       const unit_type * base_type = 
unit_types.find(type().base_id());
+                       assert(base_type != NULL);
+                       advance_to(*base_type);
                } else if ((last_effect)["apply_to"] == "type") {
                        config::attribute_value &prev_type = 
(*new_child)["prev_type"];
                        if (prev_type.blank()) prev_type = type().base_id();


_______________________________________________
Wesnoth-commits mailing list
Wesnoth-commits@gna.org
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to