Throw an error in add_modification if an unknown type is seen.

This commit is contained in:
Bruno Wolff III 2007-08-18 04:19:36 +00:00
parent ab8ce0fb96
commit 646ee18d2c

View file

@ -2454,6 +2454,9 @@ void unit::add_modification(const std::string& type, const config& mod,
variation_ = (**i.first)["name"];
wassert(gamedata_ != NULL);
const game_data::unit_type_map::const_iterator var = gamedata_->unit_types.find(id());
if(var == gamedata_->unit_types.end()) {
throw game::game_error("Unknown unit type '" + id() + "'");
}
advance_to(&var->second.get_variation(variation_));
} else if(apply_to == "profile") {
const std::string& portrait = (**i.first)["portrait"];