mail[Wesnoth-commits] r33983 - in /trunk/src: cavegen.cpp cavegen.hpp


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:22 2009
New Revision: 33983

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

Modified:
    trunk/src/cavegen.cpp
    trunk/src/cavegen.hpp

Modified: trunk/src/cavegen.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/cavegen.cpp?rev=33983&r1=33982&r2=33983&view=diff
==============================================================================
--- trunk/src/cavegen.cpp (original)
+++ trunk/src/cavegen.cpp Sat Mar 21 19:44:22 2009
@@ -222,21 +222,12 @@
                set_terrain(*i,clear_);
        }
 
-       if(c.items != NULL) {
-               
place_items(c,c.items->ordered_begin(),c.items->ordered_end());
-       }
-}
-
-void cave_map_generator::place_items(const chamber& c, 
config::all_children_iterator i1, config::all_children_iterator i2)
-{
-       if(c.locs.empty()) {
-               return;
-       }
+       if (c.items == NULL || c.locs.empty()) return;
 
        size_t index = 0;
-       while(i1 != i2) {
-               const std::string& key = *(*i1).first;
-               config cfg = *(*i1).second;
+       foreach (const config::any_child &it, c.items->all_children_range())
+       {
+               config cfg = it.cfg;
                config* const filter = cfg.child("filter");
                config* const object = cfg.child("object");
                config* object_filter = NULL;
@@ -275,11 +266,11 @@
                }
 
                // If this is a side, place a castle for the side
-               if(key == "side" && !utils::string_bool(cfg["no_castle"])) {
+               if (it.key == "side" && 
!utils::string_bool(cfg["no_castle"])) {
                        place_castle(cfg["side"],*loc);
                }
 
-               res_.add_child(key,cfg);
+               res_.add_child(it.key, cfg);
 
                if(!loc_var.empty()) {
                        config &temp = res_.add_child("event");
@@ -291,8 +282,6 @@
                        ycfg["name"] = loc_var + "_y";
                        ycfg["value"] = ybuf;
                }
-
-               ++i1;
        }
 }
 

Modified: trunk/src/cavegen.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/cavegen.hpp?rev=33983&r1=33982&r2=33983&view=diff
==============================================================================
--- trunk/src/cavegen.hpp (original)
+++ trunk/src/cavegen.hpp Sat Mar 21 19:44:22 2009
@@ -65,7 +65,6 @@
        void build_chamber(map_location loc, std::set<map_location>& locs, 
size_t size, size_t jagged);
 
        void place_chamber(const chamber& c);
-       void place_items(const chamber& c, config::all_children_iterator i1, 
config::all_children_iterator i2);
 
        void place_passage(const passage& p);
 




Related Messages


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