Author: shadowmaster
Date: Fri Sep 12 01:13:42 2008
New Revision: 29408
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29408&view=rev
Log:
* Use default ability's name= as a fallback when female_name= is
* absent, to prevent invalid output to the sidebar.
Modified:
trunk/src/unit_abilities.cpp
trunk/src/unit_types.cpp
Modified: trunk/src/unit_abilities.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_abilities.cpp?rev=29408&r1=29407&r2=29408&view=diff
==============================================================================
--- trunk/src/unit_abilities.cpp (original)
+++ trunk/src/unit_abilities.cpp Fri Sep 12 01:13:42 2008
@@ -212,8 +212,13 @@
for (config::child_map::const_iterator i = list_map.begin(),
i_end = list_map.end(); i != i_end; ++i) {
for (config::child_list::const_iterator j = i->second.begin(),
- j_end = i->second.end(); j != j_end; ++j) {
- std::string const &name = (this->gender_ ==
unit_race::MALE ? (**j)["name"] : (**j)["female_name"]);
+ j_end = i->second.end(); j != j_end; ++j)
+ {
+ std::string const &name = (
+ this->gender_ == unit_race::MALE ||
(**j)["female_name"].empty() ?
+ (**j)["name"] :
+ (**j)["female_name"]
+ );
if (!name.empty()) {
res.push_back(name);
res.push_back((**j)["description"]);
@@ -253,13 +258,23 @@
for (config::child_list::const_iterator j =
i->second.begin(),
j_end = i->second.end(); j != j_end; ++j) {
if (ability_active(i->first, **j, loc)) {
- std::string const &name = (gender_ ==
unit_race::MALE ? (**j)["name"] : (**j)["female_name"]);
+ std::string const &name = (
+ gender_ == unit_race::MALE ||
(**j)["female_name"].empty() ?
+ (**j)["name"] :
+ (**j)["female_name"]
+ );
+
if (!name.empty()) {
res.push_back(name);
res.push_back((**j)["description"]);
}
} else {
- std::string const &name = (gender_ ==
unit_race::MALE ? (**j)["name_inactive"] : (**j)["female_name_inactive"]);
+ std::string const &name = (
+ gender_ == unit_race::MALE ||
(**j)["female_name_inactive"].empty() ?
+ (**j)["name_inactive"] :
+ (**j)["female_name_inactive"]
+ );
+
if (!name.empty()) {
res.push_back(name);
res.push_back((**j)["description_inactive"]);
Modified: trunk/src/unit_types.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_types.cpp?rev=29408&r1=29407&r2=29408&view=diff
==============================================================================
--- trunk/src/unit_types.cpp (original)
+++ trunk/src/unit_types.cpp Fri Sep 12 01:13:42 2008
@@ -841,7 +841,11 @@
for(config::child_map::const_iterator j = abi.begin(); j !=
abi.end(); ++j) {
for(config::child_list::const_iterator k =
j->second.begin(); k != j->second.end(); ++k) {
if((**k)["name"] != "") {
- abilities_.push_back(genders_.front()
== unit_race::MALE ? (**k)["name"] : (**k)["female_name"]);
+ abilities_.push_back(
+ genders_.front() ==
unit_race::MALE || (**k)["female_name"].empty() ?
+ (**k)["name"] :
+ (**k)["female_name"]
+ );
ability_tooltips_.push_back((**k)["description"]);
}
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits