Author: sapient
Date: Sun May  6 00:20:13 2007
New Revision: 17350

URL: http://svn.gna.org/viewcvs/wesnoth?rev=17350&view=rev
Log:
some lines got left out of my previous commit somehow

Modified:
    trunk/src/map.cpp

Modified: trunk/src/map.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/map.cpp?rev=17350&r1=17349&r2=17350&view=diff
==============================================================================
--- trunk/src/map.cpp (original)
+++ trunk/src/map.cpp Sun May  6 00:20:13 2007
@@ -816,11 +816,17 @@
                lexical_cast_default<size_t>(filter["radius"], 0));
        get_tiles_radius(*this, xy_locs, radius, locs);
 
+       //handle [and], [or], and [not] with in-order precedence
        config::all_children_iterator cond = 
filter.get_config().ordered_begin();
        config::all_children_iterator cond_end = 
filter.get_config().ordered_end();
        int ors_left = std::count_if(cond, cond_end, cfg_isor());
        while(cond != cond_end)
        {
+               //if there are no locations or [or] conditions left, go ahead 
and return empty
+               if(locs.empty() && ors_left <= 0) {
+                       return;
+               }
+
                const std::string& cond_name = *((*cond).first);
                const vconfig cond_filter(&(*((*cond).second)));
 
@@ -846,6 +852,7 @@
                        while(insert_itor != union_hexes.end()) {
                                locs.insert(*insert_itor++);
                        }
+                       --ors_left;
                }
                //handle [not]
                else if(cond_name == "not") {
@@ -857,7 +864,6 @@
                        }
                }
 
-               //if there are no locations or [or] conditions left, go ahead 
and return empty
                ++cond;
        }
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to