Reverted 2011-04-15T23:03:01Z!upthorn@gmail.com,

since displaying traits without descriptions is desired
behavior. Re-fixed MSVC9 crash-on-unnamed-trait bug in a different
manner.
This commit is contained in:
Jody Northup 2011-04-25 09:48:04 +00:00
parent dace938515
commit 25b317f4ed

View file

@ -2588,22 +2588,22 @@ void unit::add_modification(const std::string& type, const config& mod, bool no_
const t_string& mod_description = mod["description"];
if (!mod_description.empty()) {
description = mod_description + " ";
}
// Punctuation should be translatable: not all languages use latin punctuation.
// (However, there maybe is a better way to do it)
if(effects_description.empty() == false) {
for(std::vector<t_string>::const_iterator i = effects_description.begin();
i != effects_description.end(); ++i) {
description += *i;
if(i+1 != effects_description.end())
description += t_string(N_(" and "), "wesnoth");
}
// Punctuation should be translatable: not all languages use latin punctuation.
// (However, there maybe is a better way to do it)
if(effects_description.empty() == false) {
for(std::vector<t_string>::const_iterator i = effects_description.begin();
i != effects_description.end(); ++i) {
description += *i;
if(i+1 != effects_description.end())
description += t_string(N_(" and "), "wesnoth");
}
}
// store trait info
if(type == "trait") {
add_trait_description(mod, description);
}
// store trait info
if(type == "trait") {
add_trait_description(mod, description);
}
//NOTE: if not a trait, description is currently not used
@ -2613,7 +2613,10 @@ void unit::add_trait_description(const config& trait, const t_string& descriptio
{
const std::string& gender_string = gender_ == unit_race::FEMALE ? "female_name" : "male_name";
t_string const &gender_specific_name = trait[gender_string];
const t_string& name = gender_specific_name.empty() ?
// if this is a t_string& instead of a t_string, msvc9 compiled windows binaries
// choke on the case where both gender_specific_name and trait["name"] are empty.
const t_string name = gender_specific_name.empty() ?
trait["name"] : gender_specific_name;
if(!name.empty()) {