check whether type given by type= exists in [effect]apply_to=type

(fix for bug #18489)
This commit is contained in:
Anonymissimus 2011-08-12 00:06:13 +00:00
parent 24cb062ce3
commit d8f8057477

View file

@ -2595,14 +2595,19 @@ void unit::add_modification(const std::string& type, const config& mod, bool no_
} else if ((last_effect)["apply_to"] == "type") {
config::attribute_value &prev_type = (*new_child)["prev_type"];
if (prev_type.blank()) prev_type = type_id();
type_ = last_effect["name"].str();
int hit_points = hit_points_;
int experience = experience_;
int movement = movement_;
advance_to(this->type());
hit_points_ = hit_points;
experience_ = experience;
movement_ = movement;
const std::string& type = last_effect["name"];
if(unit_types.find(type)) {
type_ = type;
int hit_points = hit_points_;
int experience = experience_;
int movement = movement_;
advance_to(this->type());
hit_points_ = hit_points;
experience_ = experience;
movement_ = movement;
} else {
WRN_UT << "unknown type= in [effect]apply_to=type, ignoring\n";
}
}
}