diff --git a/src/help/help_topic_generators.cpp b/src/help/help_topic_generators.cpp index 35795211272..52cc4e930ed 100644 --- a/src/help/help_topic_generators.cpp +++ b/src/help/help_topic_generators.cpp @@ -215,6 +215,7 @@ std::string terrain_topic_generator::operator()() const { //Typedef to help with formatting list of traits +// Maps localized trait name to trait help topic ID typedef std::pair trait_data; //Helper function for printing a list of trait data @@ -393,8 +394,12 @@ std::string unit_topic_generator::operator()() const { std::vector random_traits; int must_have_nameless_traits = 0; - for (const config & trait : traits) { - const std::string trait_name = trait["male_name"]; + for(const config& trait : traits) { + std::string trait_name = trait["male_name"].str(); + if (trait_name.empty()) trait_name = trait["female_name"].str(); + if (trait_name.empty()) trait_name = trait["name"].str(); + if (trait_name.empty()) continue; // Hidden trait + std::string lang_trait_name = translation::gettext(trait_name.c_str()); if (lang_trait_name.empty() && trait["availability"].str() == "musthave") { ++must_have_nameless_traits;