Author: ilor
Date: Tue Jul 15 16:00:31 2008
New Revision: 28040

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28040&view=rev
Log:
Add a invalidate(set<location>) member function

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

Modified: trunk/src/display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.cpp?rev=28040&r1=28039&r2=28040&view=diff
==============================================================================
--- trunk/src/display.cpp (original)
+++ trunk/src/display.cpp Tue Jul 15 16:00:31 2008
@@ -1206,10 +1206,7 @@
 
 void display::clear_highlighted_locs()
 {
-       for (std::set<gamemap::location>::const_iterator it = 
highlighted_locations_.begin();
-                it != highlighted_locations_.end(); it++) {
-               invalidate(*it);
-       }
+       invalidate(highlighted_locations_);
        highlighted_locations_.clear();
 }
 
@@ -2132,6 +2129,17 @@
        return invalidated_.insert(loc).second;
 }
 
+bool display::invalidate(const std::set<gamemap::location>& locs)
+{
+       if(invalidateAll_)
+               return false;
+       bool ret = false;
+       foreach (const gamemap::location& loc, locs) {
+               ret = invalidated_.insert(loc).second || ret;
+       }
+       return ret;
+}
+
 bool display::invalidate_locations_in_rect(const SDL_Rect& rect)
 {
        if(invalidateAll_)

Modified: trunk/src/display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.hpp?rev=28040&r1=28039&r2=28040&view=diff
==============================================================================
--- trunk/src/display.hpp (original)
+++ trunk/src/display.hpp Tue Jul 15 16:00:31 2008
@@ -238,6 +238,8 @@
 
        /** Function to invalidate a specific tile for redrawing. */
        bool invalidate(const gamemap::location& loc);
+       
+       bool invalidate(const std::set<gamemap::location>& locs);
        
        /** invalidate all hexes under the rectangle rect (in screen 
coordinates) */
        bool invalidate_locations_in_rect(const SDL_Rect& rect);


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

Reply via email to