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

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

[Wesnoth-cvs-commits] wesnoth ./changelog src/unit.cpp


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth ./changelog src/unit.cpp
Date: Fri, 29 Apr 2005 17:27:43 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    05/04/29 21:27:43

Modified files:
        .              : changelog 
        src            : unit.cpp 

Log message:
        Fix bug #12603: items appearing in the traits. Only reference names of 
effects that are in the 'trait' category.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/changelog.diff?tr1=1.631&tr2=1.632&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.cpp.diff?tr1=1.147&tr2=1.148&r1=text&r2=text

Patches:
Index: wesnoth/changelog
diff -u wesnoth/changelog:1.631 wesnoth/changelog:1.632
--- wesnoth/changelog:1.631     Fri Apr 29 19:46:43 2005
+++ wesnoth/changelog   Fri Apr 29 21:27:43 2005
@@ -3,7 +3,8 @@
    * starting position in editor now starts at player 1 (#10625)
    * fixed female units not appearing in help (broken since 0.9.0)
    * reduced required width of weapon area in help
-   * better diagnostics on parsing: line numbers
+   * better diagnostics on parsing: file inclusion sequence
+   * fixed items appearing in traits description (#12603)
  * campaign improvements:
    * fix Dacyn not being [recall]-ed in Unexpected Appearance (Eastern 
Invasion) (#10619)
    * new map and scenario modification for Drowned Plains (Eastern Invasion)
Index: wesnoth/src/unit.cpp
diff -u wesnoth/src/unit.cpp:1.147 wesnoth/src/unit.cpp:1.148
--- wesnoth/src/unit.cpp:1.147  Thu Apr 28 10:56:05 2005
+++ wesnoth/src/unit.cpp        Fri Apr 29 21:27:43 2005
@@ -1,4 +1,4 @@
-/* $Id: unit.cpp,v 1.147 2005/04/28 10:56:05 ott Exp $ */
+/* $Id: unit.cpp,v 1.148 2005/04/29 21:27:43 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1186,32 +1186,34 @@
        log_scope("apply mods");
        modificationDescriptions_.clear();
 
-       std::vector<t_string> descriptions;
-
        for(size_t i = 0; i != NumModificationTypes; ++i) {
                const std::string& mod = ModificationTypes[i];
                const config::child_list& mods = 
modifications_.get_children(mod);
                for(config::child_list::const_iterator j = mods.begin(); j != 
mods.end(); ++j) {
                        log_scope("add mod");
                        add_modification(ModificationTypes[i],**j,true);
-
-                       const t_string& name = (**j)["name"];
-                       if(name.empty() == false) {
-                               descriptions.push_back(name);
-                       }
                }
        }
 
        traitsDescription_ = "";
 
-       //we want to make sure the description always has a consistent ordering
-       std::sort(descriptions.begin(),descriptions.end());
-       for(std::vector<t_string>::const_iterator j = descriptions.begin(); j 
!= descriptions.end(); ++j) {
-               if(j != descriptions.begin()) {
+       std::vector< t_string > traits;
+       config::child_list const &mods = modifications_.get_children("trait");
+       for(config::child_list::const_iterator j = mods.begin(), j_end = 
mods.end(); j != j_end; ++j) {
+               t_string const &name = (**j)["name"];
+               if (!name.empty())
+                       traits.push_back(name);
+       }
+
+       std::vector< t_string >::iterator k = traits.begin(), k_end = 
traits.end();
+       if (k != k_end) {
+               // we want to make sure the traits always have a consistent 
ordering
+               std::sort(k, k_end);
+               for(;;) {
+                       traitsDescription_ += *(k++);
+                       if (k == k_end) break;
                        traitsDescription_ += ", ";
                }
-
-               traitsDescription_ += *j;
        }
 }
 




reply via email to

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