Skip to content

Commit

Permalink
help: Skip nameless abilities in Ability and Ability Upgrades
Browse files Browse the repository at this point in the history
Nameless abilities are relatively common outside of mainline in
particular as they are used for implementation details of more complex
abilities.

Fixes #3060.
  • Loading branch information
irydacea committed Jun 25, 2020
1 parent d5bcd28 commit ee771db
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Expand Up @@ -526,6 +526,9 @@
## Version 1.14.13+dev
### Language and i18n
* Updated translations:
### 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
Expand Down
28 changes: 22 additions & 6 deletions src/help/help_topic_generators.cpp
Expand Up @@ -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();

std::string lang_ability = translation::gettext(iter->name.c_str());
ss << make_link(lang_ability, ref_id);
if(iter->name.empty()) {
continue;
}

if(std::next(iter) != type_.abilities_metadata().end()) {
if(!start) {
ss << ", ";
} else {
start = false;
}

std::string lang_ability = translation::gettext(iter->name.c_str());
ss << make_link(lang_ability, ref_id);
}

ss << "\n\n";
Expand All @@ -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();

std::string lang_ability = translation::gettext(iter->name.c_str());
ss << make_link(lang_ability, ref_id);
if(iter->name.empty()) {
continue;
}

if(std::next(iter) != type_.adv_abilities_metadata().end()) {
if(!start) {
ss << ", ";
} else {
start = false;
}

std::string lang_ability = translation::gettext(iter->name.c_str());
ss << make_link(lang_ability, ref_id);
}

ss << "\n\n";
Expand Down

0 comments on commit ee771db

Please sign in to comment.