[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth data/traits.cfg src/tstring.cpp src/tst...
From: |
Philippe Plantier |
Subject: |
[Wesnoth-cvs-commits] wesnoth data/traits.cfg src/tstring.cpp src/tst... |
Date: |
Thu, 07 Apr 2005 17:16:50 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Philippe Plantier <address@hidden> 05/04/07 21:16:50
Modified files:
data : traits.cfg
src : tstring.cpp tstring.hpp unit.cpp unit.hpp
Log message:
Fixed traits not being always translated.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/traits.cfg.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tstring.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tstring.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.cpp.diff?tr1=1.137&tr2=1.138&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.hpp.diff?tr1=1.66&tr2=1.67&r1=text&r2=text
Patches:
Index: wesnoth/data/traits.cfg
diff -u wesnoth/data/traits.cfg:1.2 wesnoth/data/traits.cfg:1.3
--- wesnoth/data/traits.cfg:1.2 Fri Mar 11 02:40:00 2005
+++ wesnoth/data/traits.cfg Thu Apr 7 21:16:49 2005
@@ -1,5 +1,6 @@
#define TRAIT_LOYAL
[trait]
+ #textdomain wesnoth
id=loyal
name= _ "loyal"
description= _ "Zero upkeep"
@@ -11,6 +12,7 @@
#define TRAIT_UNDEAD
[trait]
+ #textdomain wesnoth
id=undead
name= _ "undead"
description= _ "Immune to poison"
@@ -19,6 +21,7 @@
#define TRAIT_STRONG
[trait]
+ #textdomain wesnoth
id=strong
name= _ "strong"
[effect]
@@ -36,6 +39,7 @@
#define TRAIT_DEXTROUS
[trait]
+ #textdomain wesnoth
id=dextrous
name= _ "dextrous"
[effect]
@@ -48,6 +52,7 @@
#define TRAIT_QUICK
[trait]
+ #textdomain wesnoth
id=quick
name= _ "quick"
[effect]
@@ -64,6 +69,7 @@
#define TRAIT_INTELLIGENT
[trait]
+ #textdomain wesnoth
id=intelligent
name= _ "intelligent"
[effect]
@@ -75,6 +81,7 @@
#define TRAIT_RESILIENT
[trait]
+ #textdomain wesnoth
id=resilient
name= _ "resilient"
[effect]
Index: wesnoth/src/tstring.cpp
diff -u wesnoth/src/tstring.cpp:1.3 wesnoth/src/tstring.cpp:1.4
--- wesnoth/src/tstring.cpp:1.3 Wed Mar 30 19:48:17 2005
+++ wesnoth/src/tstring.cpp Thu Apr 7 21:16:50 2005
@@ -1,4 +1,4 @@
-/* $Id: tstring.cpp,v 1.3 2005/03/30 19:48:17 gruikya Exp $ */
+/* $Id: tstring.cpp,v 1.4 2005/04/07 21:16:50 gruikya Exp $ */
/*
Copyright (C) 2004 by Philippe Plantier <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -431,6 +431,11 @@
bool t_string::operator!=(const std::string& string) const { return !(*this ==
string); }
bool t_string::operator!=(const char* string) const { return !(*this ==
string); }
+bool t_string::operator<(const t_string& string) const
+{
+ return value_ < string.value_;
+}
+
bool t_string::empty() const
{
return value_.empty();
Index: wesnoth/src/tstring.hpp
diff -u wesnoth/src/tstring.hpp:1.3 wesnoth/src/tstring.hpp:1.4
--- wesnoth/src/tstring.hpp:1.3 Tue Mar 29 20:19:33 2005
+++ wesnoth/src/tstring.hpp Thu Apr 7 21:16:50 2005
@@ -1,4 +1,4 @@
-/* $Id: tstring.hpp,v 1.3 2005/03/29 20:19:33 gruikya Exp $ */
+/* $Id: tstring.hpp,v 1.4 2005/04/07 21:16:50 gruikya Exp $ */
/*
Copyright (C) 2004 by Philippe Plantier <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -70,6 +70,7 @@
bool operator!=(const t_string&) const;
bool operator!=(const std::string&) const;
bool operator!=(const char*) const;
+ bool operator<(const t_string&) const;
bool empty() const;
std::string::size_type size() const;
Index: wesnoth/src/unit.cpp
diff -u wesnoth/src/unit.cpp:1.137 wesnoth/src/unit.cpp:1.138
--- wesnoth/src/unit.cpp:1.137 Mon Mar 28 19:08:58 2005
+++ wesnoth/src/unit.cpp Thu Apr 7 21:16:50 2005
@@ -1,4 +1,4 @@
-/* $Id: unit.cpp,v 1.137 2005/03/28 19:08:58 gruikya Exp $ */
+/* $Id: unit.cpp,v 1.138 2005/04/07 21:16:50 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -924,7 +924,7 @@
facingLeft_ = newval;
}
-const std::string& unit::traits_description() const
+const t_string& unit::traits_description() const
{
return traitsDescription_;
}
@@ -987,7 +987,7 @@
modifications_.add_child(type,mod);
}
- std::vector<std::string> effects_description;
+ std::vector<t_string> effects_description;
for(config::const_child_itors i = mod.child_range("effect");
i.first != i.second; ++i.first) {
@@ -1001,7 +1001,7 @@
}
}
- std::stringstream description;
+ t_string description;
const std::string& apply_to = (**i.first)["apply_to"];
@@ -1026,14 +1026,14 @@
if(first_attack) {
first_attack = false;
} else {
- description << "; ";
+ description += "; ";
}
- description <<
gettext(a->name().c_str()) << " " << desc;
+ description += a->name() + " " + desc;
}
}
} else if(apply_to == "hitpoints") {
- LOG_UT << "applying hitpoint mod...." << hitpoints_ <<
"/" << maxHitpoints_ << "\n";
+ LOG_UT << "applying hitpoint mod..." << hitpoints_ <<
"/" << maxHitpoints_ << "\n";
const std::string& increase_hp =
(**i.first)["increase"];
const std::string& heal_full = (**i.first)["heal_full"];
const std::string& increase_total =
(**i.first)["increase_total"];
@@ -1042,7 +1042,8 @@
const std::string& violate_max =
(**i.first)["violate_maximum"];
if(increase_total.empty() == false) {
- description << (increase_total[0] != '-' ? "+"
: "") << increase_total << _("HP");
+ description += (increase_total[0] != '-' ? "+"
: "") + increase_total +
+ t_string(N_("HP"), "wesnoth");
//a percentage on the end means increase by
that many percent
if(increase_total[increase_total.size()-1] ==
'%') {
@@ -1078,7 +1079,8 @@
const std::string& set_to = (**i.first)["set"];
if(increase.empty() == false) {
- description << (increase[0] != '-' ? "+" : "")
<< increase << _("Moves");
+ description += (increase[0] != '-' ? "+" : "")
+ increase +
+ t_string(N_("Moves"), "wesnoth");
if(increase[increase.size()-1] == '%') {
const std::string
inc(increase.begin(),increase.end()-1);
@@ -1101,7 +1103,9 @@
const std::string& increase = (**i.first)["increase"];
if(increase.empty() == false) {
- description << (increase[0] != '-' ? "+" : "")
<< increase << _("XP");
+ description += (increase[0] != '-' ? "+" : "") +
+ increase + t_string(N_("XP"),
"wesnoth");
+
if(increase[increase.size()-1] == '%') {
const std::string
inc(increase.begin(),increase.end()-1);
maxExperience_ +=
(maxExperience_*atoi(inc.c_str()))/100;
@@ -1129,30 +1133,31 @@
}
}
- const std::string desc = description.str();
- if(!desc.empty())
- effects_description.push_back(desc);
+ if(!description.empty())
+ effects_description.push_back(description);
}
- std::stringstream description;
- description << mod["name"] << ": ";
- if(mod["id"].empty() == false) {
- description << mod["description"] << " ";
+ t_string& description = modificationDescriptions_[type];
+
+ // FIXME: the colon must be translatable.
+ description += mod["name"] + ": ";
+ if(!mod["description"].empty()) {
+ description += mod["description"];
+ description += " ";
}
if(effects_description.empty() == false) {
- description << "(";
- for(std::vector<std::string>::const_iterator i =
effects_description.begin(); i != effects_description.end(); ++i) {
- description << *i;
+ description += "(";
+ 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 << "; ";
+ description += "; ";
}
- description << ")";
+ description += ")";
}
- description << "\n";
-
- modificationDescriptions_[type] = modificationDescriptions_[type].str()
+ description.str();
+ description += "\n";
}
void unit::reset_modifications()
@@ -1172,7 +1177,7 @@
log_scope("apply mods");
modificationDescriptions_.clear();
- std::vector<std::string> descriptions;
+ std::vector<t_string> descriptions;
for(size_t i = 0; i != NumModificationTypes; ++i) {
const std::string& mod = ModificationTypes[i];
@@ -1181,7 +1186,7 @@
log_scope("add mod");
add_modification(ModificationTypes[i],**j,true);
- const std::string& name = (**j)["id"];
+ const t_string& name = (**j)["name"];
if(name.empty() == false) {
descriptions.push_back(name);
}
@@ -1192,25 +1197,12 @@
//we want to make sure the description always has a consistent ordering
std::sort(descriptions.begin(),descriptions.end());
- for(std::vector<std::string>::const_iterator j = descriptions.begin();
j != descriptions.end(); ++j) {
+ for(std::vector<t_string>::const_iterator j = descriptions.begin(); j
!= descriptions.end(); ++j) {
if(j != descriptions.begin()) {
traitsDescription_ += ", ";
}
- //traitsDescription_ += gettext(j->c_str());
- std::vector<config*> possible_traits = type().possible_traits();
- std::vector<config*>::const_iterator trait;
-
- for(trait = possible_traits.begin(); trait !=
possible_traits.end(); ++trait) {
- if((**trait)["id"] == *j)
- break;
- }
-
- if(trait == possible_traits.end()) {
- traitsDescription_ += *j;
- } else {
- traitsDescription_ += (**trait)["name"];
- }
+ traitsDescription_ += *j;
}
}
@@ -1228,11 +1220,11 @@
}
}
-const std::string& unit::modification_description(const std::string& type)
const
+const t_string& unit::modification_description(const std::string& type) const
{
const string_map::const_iterator i =
modificationDescriptions_.find(type);
if(i == modificationDescriptions_.end()) {
- static const std::string empty_string;
+ static const t_string empty_string;
return empty_string;
} else {
return i->second;
Index: wesnoth/src/unit.hpp
diff -u wesnoth/src/unit.hpp:1.66 wesnoth/src/unit.hpp:1.67
--- wesnoth/src/unit.hpp:1.66 Mon Mar 28 15:00:13 2005
+++ wesnoth/src/unit.hpp Thu Apr 7 21:16:50 2005
@@ -1,4 +1,4 @@
-/* $Id: unit.hpp,v 1.66 2005/03/28 15:00:13 gruikya Exp $ */
+/* $Id: unit.hpp,v 1.67 2005/04/07 21:16:50 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -133,7 +133,7 @@
bool facing_left() const;
void set_facing_left(bool newval);
- const std::string& traits_description() const;
+ const t_string& traits_description() const;
int value() const;
bool is_guardian() const;
@@ -153,7 +153,7 @@
void add_modification(const std::string& type, const config&
modification,
bool no_add=false);
- const std::string& modification_description(const std::string& type)
const;
+ const t_string& modification_description(const std::string& type) const;
bool move_interrupted() const;
const gamemap::location& get_interrupted_move() const;
@@ -211,7 +211,7 @@
config modifications_;
- std::string traitsDescription_;
+ t_string traitsDescription_;
string_map modificationDescriptions_;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth data/traits.cfg src/tstring.cpp src/tst...,
Philippe Plantier <=