mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 17:53:27 +00:00
Clarify description's modification code (runs on all modif, not just trait)
Fix old bug: trait without any description created blank line in tooltip (testcase: footpad with 'hairdo' trait in test-scenario)
This commit is contained in:
parent
f704606ba7
commit
a748bbf2f4
36
src/unit.cpp
36
src/unit.cpp
@ -2530,35 +2530,39 @@ void unit::add_modification(const std::string& type, const config& mod, bool no_
|
|||||||
movement_ = movement;
|
movement_ = movement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t_string& description = modification_descriptions_[type];
|
|
||||||
t_string trait_description;
|
t_string description;
|
||||||
|
|
||||||
|
const t_string& mod_description = mod["description"];
|
||||||
|
if (!mod_description.empty()) {
|
||||||
|
description = mod_description + " ";
|
||||||
|
}
|
||||||
|
|
||||||
// Punctuation should be translatable: not all languages use latin punctuation.
|
// Punctuation should be translatable: not all languages use latin punctuation.
|
||||||
// (However, there maybe is a better way to do it)
|
// (However, there maybe is a better way to do it)
|
||||||
if (!mod["description"].empty()) {
|
|
||||||
trait_description += mod["description"] + " ";
|
|
||||||
}
|
|
||||||
if(effects_description.empty() == false) {
|
if(effects_description.empty() == false) {
|
||||||
//trait_description += t_string(N_("("), "wesnoth");
|
|
||||||
for(std::vector<t_string>::const_iterator i = effects_description.begin();
|
for(std::vector<t_string>::const_iterator i = effects_description.begin();
|
||||||
i != effects_description.end(); ++i) {
|
i != effects_description.end(); ++i) {
|
||||||
trait_description += *i;
|
description += *i;
|
||||||
if(i+1 != effects_description.end())
|
if(i+1 != effects_description.end())
|
||||||
trait_description += t_string(N_(" and "), "wesnoth");
|
description += t_string(N_(" and "), "wesnoth");
|
||||||
}
|
}
|
||||||
//trait_description += t_string(N_(")"), "wesnoth");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mod["name"].empty()) {
|
const t_string& mod_name = mod["name"];
|
||||||
|
if (!mod_name.empty()) {
|
||||||
utils::string_map symbols;
|
utils::string_map symbols;
|
||||||
symbols["trait_name"] = mod["name"];
|
// This is not specific to traits, but only visible there,
|
||||||
symbols["trait_description"] = trait_description;
|
// so we tell that to translators
|
||||||
description += vgettext("$trait_name|: $trait_description ", symbols);
|
symbols["trait_name"] = mod_name;
|
||||||
} else if (!trait_description.empty()) {
|
symbols["trait_description"] = description;
|
||||||
description += trait_description;
|
description = vgettext("$trait_name|: $trait_description ", symbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
description += "\n";
|
if(!description.empty())
|
||||||
|
description += "\n";
|
||||||
|
|
||||||
|
modification_descriptions_[type] += description;
|
||||||
}
|
}
|
||||||
|
|
||||||
const t_string& unit::modification_description(const std::string& type) const
|
const t_string& unit::modification_description(const std::string& type) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user