Fix sidebar's display of attacks with damage_type specials
When a [damage_type] affected an attack, the old code assumed that it would have an alternative_type. If that assumption failed, it would add ("type_" + an empty string), causing "UNTLB type_" to be shown in the sidebar. UNTLB is itself a shorthand for "untranslatable", see language.cpp for an explanation.
This commit is contained in:
parent
f4e8635723
commit
84c62456a3
1 changed files with 6 additions and 4 deletions
|
@ -1261,14 +1261,16 @@ std::pair<std::string, std::string> attack_type::damage_type() const
|
|||
|
||||
std::set<std::string> attack_type::alternative_damage_types() const
|
||||
{
|
||||
unit_ability_list damage_alternative_type_list = get_specials_and_abilities("damage_type");
|
||||
if(damage_alternative_type_list.empty()){
|
||||
unit_ability_list damage_type_list = get_specials_and_abilities("damage_type");
|
||||
if(damage_type_list.empty()){
|
||||
return {};
|
||||
}
|
||||
std::set<std::string> damage_types;
|
||||
for(auto& i : damage_alternative_type_list) {
|
||||
for(auto& i : damage_type_list) {
|
||||
const config& c = *i.ability_cfg;
|
||||
damage_types.insert(c["alternative_type"].str());
|
||||
if(c.has_attribute("alternative_type")){
|
||||
damage_types.insert(c["alternative_type"].str());
|
||||
}
|
||||
}
|
||||
|
||||
return damage_types;
|
||||
|
|
Loading…
Add table
Reference in a new issue