diff --git a/src/dialogs.cpp b/src/dialogs.cpp index 59135ec806e..84235aae74a 100644 --- a/src/dialogs.cpp +++ b/src/dialogs.cpp @@ -971,10 +971,8 @@ const unit_types_preview_pane::details unit_types_preview_pane::get_details() co det.level = t->level(); det.alignment = unit_type::alignment_description(t->alignment(), t->genders().front()); - if (const unit_race *r = unit_types.find_race(t->race_id())) { assert(!t->genders().empty()); - det.race = r->name(t->genders().front()); - } + det.race = t->race()->name(t->genders().front()); //FIXME: This probably must be move into a unit_type function BOOST_FOREACH(const config &tr, t->possible_traits()) diff --git a/src/gui/dialogs/unit_create.cpp b/src/gui/dialogs/unit_create.cpp index b4a4a5830de..a1ddb2230d1 100644 --- a/src/gui/dialogs/unit_create.cpp +++ b/src/gui/dialogs/unit_create.cpp @@ -117,18 +117,12 @@ void tunit_create::pre_show(CVideo& /*video*/, twindow& window) // And so we map an unit_type id to a list subscript. Ugh. type_ids_.push_back(i.first); - std::string race_label; - - if (const unit_race *r = unit_types.find_race(i.second.race_id())) { - race_label = r->plural_name(); - } - std::map< std::string, string_map > row_data; string_map column; column["label"] = i.second.type_name(); row_data.insert(std::make_pair("unit_type", column)); - column["label"] = race_label; + column["label"] = i.second.race()->plural_name(); row_data.insert(std::make_pair("race", column)); list.add_row(row_data); diff --git a/src/help.cpp b/src/help.cpp index 125eb68cd22..8ff872b34db 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -1442,10 +1442,8 @@ public: // Print the race of the unit, cross-reference it to the // respective topic. const std::string race_id = type_.race_id(); - std::string race_name; - if (const unit_race *r = unit_types.find_race(race_id)) { - race_name = r->plural_name(); - } else { + std::string race_name = type_.race()->plural_name(); + if ( race_name.empty() ) { race_name = _ ("race^Miscellaneous"); } ss << _("Race: "); diff --git a/src/menu_events.cpp b/src/menu_events.cpp index f2e807ed8c0..279fb47c967 100644 --- a/src/menu_events.cpp +++ b/src/menu_events.cpp @@ -1303,11 +1303,7 @@ void menu_handler::create_unit(mouse_handler& mousehandler) unit_types.find(i.first, unit_type::HELP_INDEX); - std::string race; - if (const unit_race *r = unit_types.find_race(i.second.race_id())) { - race = r->plural_name(); - } - row << race << COLUMN_SEPARATOR; + row << i.second.race()->plural_name() << COLUMN_SEPARATOR; row << i.second.type_name() << COLUMN_SEPARATOR; options.push_back(row.str());