Help: Use female_name
and name
as fallback when male_name
is empty and don't list hidden traits.
This algorithm was lifted from help::generate_trait_topics(). Fixes #3284
This commit is contained in:
parent
29e814d8f4
commit
a4b0de5ece
1 changed files with 6 additions and 1 deletions
|
@ -277,6 +277,7 @@ std::string terrain_topic_generator::generate() const
|
|||
//
|
||||
|
||||
// Typedef to help with formatting list of traits
|
||||
// Maps localized trait name to trait help topic ID
|
||||
using trait_data = std::pair<std::string, std::string>;
|
||||
|
||||
#if 0
|
||||
|
@ -461,7 +462,11 @@ std::string unit_topic_generator::generate() const
|
|||
int must_have_nameless_traits = 0;
|
||||
|
||||
for(const config& trait : traits) {
|
||||
const std::string trait_name = trait["male_name"];
|
||||
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue