help: Skip nameless abilities in Ability and Ability Upgrades

Nameless abilities are relatively common outside of mainline in
particular as they are used for implementation details of more complex
abilities.

Fixes #3060.
This commit is contained in:
Iris Morelle 2020-06-25 17:17:35 -04:00
parent 9b380c6e20
commit 48ef3b9fc3
2 changed files with 27 additions and 8 deletions

View file

@ -2,6 +2,9 @@
### Language and i18n
* Updated translations: Chinese (Simplified), Esperanto, Italian, Portuguese (Brazil),
Russian
### User interface
* Do not list nameless abilities in the Abilities and Ability Upgrades lists in unit
descriptions in Help (issue #3060).
### Miscellaneous and bug fixes
## Version 1.14.13

View file

@ -471,15 +471,23 @@ std::string unit_topic_generator::operator()() const {
if(!type_.abilities_metadata().empty()) {
ss << _("Abilities: ");
bool start = true;
for(auto iter = type_.abilities_metadata().begin(); iter != type_.abilities_metadata().end(); ++iter) {
const std::string ref_id = ability_prefix + iter->id + iter->name.base_str();
if(iter->name.empty()) {
continue;
}
if(!start) {
ss << ", ";
} else {
start = false;
}
std::string lang_ability = translation::gettext(iter->name.c_str());
ss << make_link(lang_ability, ref_id);
if(std::next(iter) != type_.abilities_metadata().end()) {
ss << ", ";
}
}
ss << "\n\n";
@ -489,15 +497,23 @@ std::string unit_topic_generator::operator()() const {
if(!type_.adv_abilities_metadata().empty()) {
ss << _("Ability Upgrades: ");
bool start = true;
for(auto iter = type_.adv_abilities_metadata().begin(); iter != type_.adv_abilities_metadata().end(); ++iter) {
const std::string ref_id = ability_prefix + iter->id + iter->name.base_str();
if(iter->name.empty()) {
continue;
}
if(!start) {
ss << ", ";
} else {
start = false;
}
std::string lang_ability = translation::gettext(iter->name.c_str());
ss << make_link(lang_ability, ref_id);
if(std::next(iter) != type_.adv_abilities_metadata().end()) {
ss << ", ";
}
}
ss << "\n\n";