mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-09 20:52:04 +00:00
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 (cherry-picked from commit a4b0de5ece5a9bf1edac3b6f49dfac647ff1194f)
This commit is contained in:
parent
613ea51823
commit
cb88a7a232
@ -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<std::string, std::string> trait_data;
|
||||
|
||||
//Helper function for printing a list of trait data
|
||||
@ -393,8 +394,12 @@ std::string unit_topic_generator::operator()() const {
|
||||
std::vector<trait_data> 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user