Find the base unit type before applying a variation [effect].

Fixes bug #20604.
This commit is contained in:
J. Tyne 2013-03-09 21:17:16 +00:00
parent 7dca188c77
commit ee3d026dc2

View file

@ -2637,7 +2637,9 @@ void unit::add_modification(const std::string& mod_type, const config& mod, bool
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();