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

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

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


From: Cedric Duval
Subject: [Wesnoth-cvs-commits] wesnoth/src help.cpp
Date: Thu, 21 Oct 2004 11:14:07 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Cedric Duval <address@hidden>   04/10/21 15:06:13

Modified files:
        src            : help.cpp 

Log message:
        Replaced hack to find advancements with a proper lookup from unit_types.
        Fixes issues with translating female-only units.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.39&tr2=1.40&r1=text&r2=text

Patches:
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.39 wesnoth/src/help.cpp:1.40
--- wesnoth/src/help.cpp:1.39   Tue Oct 19 21:09:48 2004
+++ wesnoth/src/help.cpp        Thu Oct 21 15:06:13 2004
@@ -572,17 +572,14 @@
                                for (std::vector<std::string>::const_iterator 
advance_it = next_units.begin();
                                         advance_it != next_units.end(); 
advance_it++) {
                                        std::string unit_id = *advance_it;
-                                       std::string lang_unit = 
gettext(unit_id.c_str());
-                                       // Remove the spaces, which will create 
the ID to
-                                       // reference to. This relies a bit on 
that we know
-                                       // that unit_type::id() does this.
-                                       
unit_id.erase(std::remove(unit_id.begin(), unit_id.end(), ' '),
-                                                                 
unit_id.end());
-                                       std::string ref_id = 
std::string("unit_") + unit_id;
-                                       ss << "<ref>dst='" << escape(ref_id) << 
"' text='" << escape(lang_unit)
-                                          << "'</ref>";
-                                       if (advance_it + 1 != next_units.end()) 
{
-                                               ss << ", ";
+                                       
std::map<std::string,unit_type>::iterator new_type = 
game_info->unit_types.find(unit_id);
+                                       if(new_type != 
game_info->unit_types.end()) {
+                                               std::string lang_unit = 
new_type->second.language_name();
+                                               std::string ref_id = 
std::string("unit_") + new_type->second.id();
+                                               ss << "<ref>dst='" << 
escape(ref_id) << "' text='" << escape(lang_unit) << "'</ref>";
+                                               if (advance_it + 1 != 
next_units.end()) {
+                                                       ss << ", ";
+                                               }
                                        }
                                }
                                ss << "\n";




reply via email to

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