mail[Wesnoth-commits] r33986 - /trunk/src/unit_types.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on March 21, 2009 - 19:44:
Author: silene
Date: Sat Mar 21 19:44:33 2009
New Revision: 33986

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33986&view=rev
Log:
Moved to loops based on config::all_children_range.

Modified:
    trunk/src/unit_types.cpp

Modified: trunk/src/unit_types.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_types.cpp?rev=33986&r1=33985&r2=33986&view=diff
==============================================================================
--- trunk/src/unit_types.cpp (original)
+++ trunk/src/unit_types.cpp Sat Mar 21 19:44:33 2009
@@ -161,12 +161,11 @@
                config* specials = cfg_.child("specials");
                if (specials != NULL) {
                        config new_specials;
-                       for(config::all_children_iterator s = 
specials->ordered_begin(); s != specials->ordered_end(); ++s) {
-                               const config::any_child &vp = *s;
+                       foreach (const config::any_child &vp, 
specials->all_children_range()) {
                                std::vector<std::string>::const_iterator 
found_id =
-                                       
std::find(dsl.begin(),dsl.end(),vp.second->get_attribute("id"));
+                                       std::find(dsl.begin(), dsl.end(), 
vp.cfg["id"]);
                                if (found_id == dsl.end()) {
-                                       
new_specials.add_child(*vp.first,*vp.second);
+                                       new_specials.add_child(vp.key, 
vp.cfg);
                                }
                        }
                        cfg_.clear_children("specials");
@@ -184,9 +183,8 @@
                        cfg_.add_child("specials");
                        new_specials = cfg_.child("specials");
                }
-               for(config::all_children_iterator s = 
set_specials->ordered_begin(); s != set_specials->ordered_end(); ++s) {
-                       const config::any_child &value = *s;
-                       new_specials->add_child(*value.first,*value.second);
+               foreach (const config::any_child &value, 
set_specials->all_children_range()) {
+                       new_specials->add_child(value.key, value.cfg);
                }
        }
 




Related Messages


Powered by MHonArc, Updated Sat Mar 21 20:00:36 2009