wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src actions.cpp help.cpp unit_types.cpp...


From: Philippe Plantier
Subject: [Wesnoth-cvs-commits] wesnoth/src actions.cpp help.cpp unit_types.cpp...
Date: Sun, 21 Aug 2005 13:27:15 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Philippe Plantier <address@hidden>      05/08/21 17:27:15

Modified files:
        src            : actions.cpp help.cpp unit_types.cpp 
                         unit_types.hpp 

Log message:
        Fixed #12788, and 14113, by replacing the [unit]/[attack]/name WML 
element by
        the description element, which is a normal, to-be-marked-translatable, 
element.
        
        name is still supported. Defining name=x on an attack name is 
equivalent to
        defining description=_"x" and icon="attacks/x.png". This way, legacy 
user
        campaigns should still work OK.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.236&tr2=1.237&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.113&tr2=1.114&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.cpp.diff?tr1=1.105&tr2=1.106&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.hpp.diff?tr1=1.71&tr2=1.72&r1=text&r2=text

Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.236 wesnoth/src/actions.cpp:1.237
--- wesnoth/src/actions.cpp:1.236       Wed Aug 17 13:25:58 2005
+++ wesnoth/src/actions.cpp     Sun Aug 21 17:27:15 2005
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.236 2005/08/17 13:25:58 ott Exp $ */
+/* $Id: actions.cpp,v 1.237 2005/08/21 17:27:15 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -370,7 +370,7 @@
        res.attacker_slows = res.attacker_special == slow_string;
 
        if (strings) {
-               strings->attack_name = egettext(attack.name().c_str());
+               strings->attack_name = attack.name();
                strings->attack_type = egettext(attack.type().c_str());
                strings->attack_special = 
egettext(res.attacker_special.c_str());
                strings->attack_icon = attack.icon();
@@ -492,7 +492,7 @@
                res.ndefends = defend.num_attacks();
 
                if (strings) {
-                       strings->defend_name = egettext(defend.name().c_str());
+                       strings->defend_name = defend.name();
                        strings->defend_type = egettext(defend.type().c_str());
                        strings->defend_special = 
egettext(res.defender_special.c_str());
                        strings->defend_icon = defend.icon();
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.113 wesnoth/src/help.cpp:1.114
--- wesnoth/src/help.cpp:1.113  Mon Aug  8 12:28:11 2005
+++ wesnoth/src/help.cpp        Sun Aug 21 17:27:15 2005
@@ -1126,7 +1126,7 @@
                        for(std::vector<attack_type>::const_iterator attack_it 
= attacks.begin(),
                                 attack_end = attacks.end();
                                 attack_it != attack_end; ++attack_it) {
-                               std::string lang_weapon = 
gettext(attack_it->name().c_str());
+                               std::string lang_weapon = attack_it->name();
                                std::string lang_type = 
gettext(attack_it->type().c_str());
                                std::vector<item> row;
                                std::stringstream attack_ss;
Index: wesnoth/src/unit_types.cpp
diff -u wesnoth/src/unit_types.cpp:1.105 wesnoth/src/unit_types.cpp:1.106
--- wesnoth/src/unit_types.cpp:1.105    Sat Jul  2 21:37:19 2005
+++ wesnoth/src/unit_types.cpp  Sun Aug 21 17:27:15 2005
@@ -1,4 +1,4 @@
-/* $Id: unit_types.cpp,v 1.105 2005/07/02 21:37:19 ott Exp $ */
+/* $Id: unit_types.cpp,v 1.106 2005/08/21 17:27:15 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -153,14 +153,18 @@
                animation_.push_back(unit_animation(cfg));
        }
 
-       name_ = cfg["name"];
+       std::string name = cfg["name"];
+       description_ = cfg["description"];
+       if (description_.empty())
+               description_ = egettext(name.c_str());
+
        type_ = cfg["type"];
        special_ = cfg["special"];
        backstab_ = special_ == "backstab";
        slow_ = special_ == "slow";
        icon_ = cfg["icon"];
        if(icon_.empty())
-               icon_ = "attacks/" + name_ + ".png";
+               icon_ = "attacks/" + name + ".png";
 
        range_ = cfg["range"] == "long" ? LONG_RANGE : SHORT_RANGE;
        damage_ = atol(cfg["damage"].c_str());
@@ -174,9 +178,9 @@
          defense_weight_ = 1.0;
 }
 
-const std::string& attack_type::name() const
+const t_string& attack_type::name() const
 {
-       return name_;
+       return description_;
 }
 
 const std::string& attack_type::type() const
@@ -272,7 +276,7 @@
        if(!matches_filter(cfg))
                return false;
 
-       const std::string& set_name = cfg["set_name"];
+       const t_string& set_name = cfg["set_name"];
        const std::string& set_type = cfg["set_type"];
        const std::string& set_special = cfg["set_special"];
        const std::string& increase_damage = cfg["increase_damage"];
@@ -281,7 +285,7 @@
        std::stringstream desc;
 
        if(set_name.empty() == false) {
-               name_ = set_name;
+               description_ = set_name;
        }
 
        if(set_type.empty() == false) {
Index: wesnoth/src/unit_types.hpp
diff -u wesnoth/src/unit_types.hpp:1.71 wesnoth/src/unit_types.hpp:1.72
--- wesnoth/src/unit_types.hpp:1.71     Sat Jul  2 21:37:19 2005
+++ wesnoth/src/unit_types.hpp  Sun Aug 21 17:27:15 2005
@@ -1,4 +1,4 @@
-/* $Id: unit_types.hpp,v 1.71 2005/07/02 21:37:19 ott Exp $ */
+/* $Id: unit_types.hpp,v 1.72 2005/08/21 17:27:15 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -79,7 +79,7 @@
        enum RANGE { SHORT_RANGE, LONG_RANGE };
 
        attack_type(const config& cfg);
-       const std::string& name() const;
+       const t_string& name() const;
        const std::string& type() const;
        const std::string& special() const;
        const std::string& icon() const;
@@ -102,7 +102,7 @@
 private:
        std::vector<unit_animation> animation_;
        std::vector<unit_animation> direction_animation_[6];
-       std::string name_;
+       t_string description_;
        std::string type_;
        std::string special_;
        std::string icon_;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]