Author: alink
Date: Sun Jul 6 00:20:59 2008
New Revision: 27771
URL: http://svn.gna.org/viewcvs/wesnoth?rev=27771&view=rev
Log:
Fix some some messy half-translated generated topic id for abilities in help.
Previously, these topic id was "ability_"+translated name of ability, which
was ugly and forced to translate hyperlink's url too (and that was not done)
This also fix these few broken hyperlinks in help too.
Modified:
trunk/src/dialogs.cpp
trunk/src/dialogs.hpp
trunk/src/help.cpp
trunk/src/unit_types.hpp
Modified: trunk/src/dialogs.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/dialogs.cpp?rev=27771&r1=27770&r2=27771&view=diff
==============================================================================
--- trunk/src/dialogs.cpp (original)
+++ trunk/src/dialogs.cpp Sun Jul 6 00:20:59 2008
@@ -833,11 +833,11 @@
<< det.alignment << "\n"
<< det.traits << "\n";
- for(std::vector<std::string>::const_iterator a = det.abilities.begin();
a != det.abilities.end(); a++) {
+ for(std::vector<t_string>::const_iterator a = det.abilities.begin(); a
!= det.abilities.end(); a++) {
if(a != det.abilities.begin()) {
text << ", ";
}
- text << gettext(a->c_str());
+ text << (*a);
}
text << "\n";
Modified: trunk/src/dialogs.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/dialogs.hpp?rev=27771&r1=27770&r2=27771&view=diff
==============================================================================
--- trunk/src/dialogs.hpp (original)
+++ trunk/src/dialogs.hpp Sun Jul 6 00:20:59 2008
@@ -85,7 +85,7 @@
std::string name, type_name;
int level;
std::string alignment, traits;
- std::vector<std::string> abilities;
+ std::vector<t_string> abilities;
int hitpoints, max_hitpoints;
int experience, max_experience;
std::string hp_color, xp_color;
Modified: trunk/src/help.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/help.cpp?rev=27771&r1=27770&r2=27771&view=diff
==============================================================================
--- trunk/src/help.cpp (original)
+++ trunk/src/help.cpp Sun Jul 6 00:20:59 2008
@@ -1119,7 +1119,7 @@
std::vector<topic> generate_ability_topics(const bool sort_generated)
{
std::vector<topic> topics;
- std::map<std::string, std::string> ability_description;
+ std::map<t_string, std::string> ability_description;
std::map<std::string, std::set<std::string> > ability_units;
// Look through all the unit types, check if a unit of this type
// should have a full description, if so, add this units abilities
@@ -1131,15 +1131,13 @@
if (description_type(type) == FULL_DESCRIPTION) {
std::vector<std::string> descriptions =
type.ability_tooltips();
std::vector<std::string>::const_iterator desc_it =
descriptions.begin();
- for (std::vector<std::string>::const_iterator it =
type.abilities().begin();
+ for (std::vector<t_string>::const_iterator it =
type.abilities().begin();
it != type.abilities().end(); ++it, ++desc_it)
{
if (ability_description.find(*it) ==
ability_description.end()) {
//new ability, generate a description
std::string description;
if(desc_it != descriptions.end()) {
description = *desc_it;
- } else {
- description = string_table[*it
+ "_description"];
}
const size_t colon_pos =
description.find(':');
if (colon_pos != std::string::npos) {
@@ -1162,9 +1160,10 @@
}
}
- for (std::map<std::string, std::string>::iterator a =
ability_description.begin(); a != ability_description.end(); a++) {
+ for (std::map<t_string, std::string>::iterator a =
ability_description.begin(); a != ability_description.end(); a++) {
std::string name = utils::capitalize(gettext(a->first.c_str()));
- std::string id = "ability_" + a->first;
+ // we generate topic's id using the untranslated version of the
ability's name
+ std::string id = "ability_" + a->first.base_str();
std::stringstream text;
text << a->second; //description
text << "\n\n" << _("<header>text='Units having this
ability'</header>") << "\n";
@@ -1302,10 +1301,10 @@
// to their respective topics.
if (!type_.abilities().empty()) {
ss << _("Abilities: ");
- for(std::vector<std::string>::const_iterator ability_it
= type_.abilities().begin(),
+ for(std::vector<t_string>::const_iterator ability_it =
type_.abilities().begin(),
ability_end = type_.abilities().end();
ability_it != ability_end; ++ability_it) {
- const std::string ref_id =
std::string("ability_") + *ability_it;
+ const std::string ref_id = "ability_" +
ability_it->base_str();
std::string lang_ability =
gettext(ability_it->c_str());
ss << "<ref>dst='" << escape(ref_id) << "'
text='" << escape(lang_ability)
<< "'</ref>";
Modified: trunk/src/unit_types.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_types.hpp?rev=27771&r1=27770&r2=27771&view=diff
==============================================================================
--- trunk/src/unit_types.hpp (original)
+++ trunk/src/unit_types.hpp Sun Jul 6 00:20:59 2008
@@ -223,7 +223,7 @@
fixed_t alpha() const { return alpha_; }
- const std::vector<std::string>& abilities() const { return abilities_; }
+ const std::vector<t_string>& abilities() const { return abilities_; }
const std::vector<std::string>& ability_tooltips() const { return
ability_tooltips_; }
bool can_advance() const { return !advances_to_.empty(); }
@@ -277,7 +277,7 @@
fixed_t alpha_;
- std::vector<std::string> abilities_;
+ std::vector<t_string> abilities_;
std::vector<std::string> ability_tooltips_;
bool zoc_, hide_help_;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits