mail[Wesnoth-commits] r27420 - in /trunk/src: display.cpp display.hpp game_display.cpp game_display.hpp


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

Header


Content

Posted by alinktomine on June 23, 2008 - 01:08:
Author: alink
Date: Mon Jun 23 00:13:21 2008
New Revision: 27420

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27420&view=rev
Log:
little cleaning of invalidations functions

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

Modified: trunk/src/display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.cpp?rev=27420&r1=27419&r2=27420&view=diff
==============================================================================
--- trunk/src/display.cpp (original)
+++ trunk/src/display.cpp Mon Jun 23 00:13:21 2008
@@ -1056,17 +1056,6 @@
        invalidate(mouseoverHex_);
 }
 
-bool display::invalidate_locations_in_rect(const SDL_Rect& rect)
-{
-       bool result = false;
-       rect_of_hexes hexes = hexes_under_rect(rect);
-       rect_of_hexes::iterator i = hexes.begin(), end = hexes.end();
-       for (;i != end; ++i) {
-               result |= invalidate(*i);
-       }
-       return result;
-}
-
 void display::set_diagnostic(const std::string& msg)
 {
        if(diagnostic_label_ != 0) {
@@ -1737,14 +1726,6 @@
        if(ypos < 0) {
                ypos = 0;
        }
-}
-
-void display::invalidate_all()
-{
-       DBG_DP << "invalidate_all()\n";
-       invalidateAll_ = true;
-       invalidated_.clear();
-       update_rect(map_area());
 }
 
 double display::turbo_speed() const
@@ -2134,8 +2115,41 @@
        }
 }
 
+void display::invalidate_all()
+{
+       DBG_DP << "invalidate_all()\n";
+       invalidateAll_ = true;
+       invalidated_.clear();
+       update_rect(map_area());
+}
+
+bool display::invalidate(const gamemap::location& loc)
+{
+       if(invalidateAll_)
+               return false;
+       
+       return invalidated_.insert(loc).second;
+}
+
+bool display::invalidate_locations_in_rect(const SDL_Rect& rect)
+{
+       if(invalidateAll_)
+               return false;
+
+       bool result = false;
+       rect_of_hexes hexes = hexes_under_rect(rect);
+       rect_of_hexes::iterator i = hexes.begin(), end = hexes.end();
+       for (;i != end; ++i) {
+               result |= invalidate(*i);
+       }
+       return result;
+}
+
 bool display::rectangle_need_update(const SDL_Rect& rect) const
 {
+       if(invalidateAll_)
+               return true;
+       
        rect_of_hexes hexes = hexes_under_rect(rect);
        rect_of_hexes::iterator i = hexes.begin(), end = hexes.end();
        for (;i != end; ++i) {

Modified: trunk/src/display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.hpp?rev=27420&r1=27419&r2=27420&view=diff
==============================================================================
--- trunk/src/display.hpp (original)
+++ trunk/src/display.hpp Mon Jun 23 00:13:21 2008
@@ -219,11 +219,19 @@
                      bool brightened = false);
 
        // Will be overridden in the display subclass
-       virtual bool invalidate(const gamemap::location& loc) {return 
invalidated_.insert(loc).second;};
+       virtual void draw_minimap_units() {};
+       
+       //! Function to invalidate all tiles.
+       void invalidate_all();
+
+       //! Function to invalidate a specific tile for redrawing.
+       bool invalidate(const gamemap::location& loc);
+       
+       //! invalidate all hexes under the rectangle rect (in screen 
coordinates)
+       bool invalidate_locations_in_rect(const SDL_Rect& rect);
+
+       //! check if an hexes under the rectangle is invalidated
        bool rectangle_need_update(const SDL_Rect& rect) const;
-       virtual void draw_minimap_units() {};
-
-       bool invalidate_locations_in_rect(const SDL_Rect& rect);
 
        /**
         * Function to invalidate animated terrains which may have changed.
@@ -325,9 +333,6 @@
 
        void bounds_check_position();
        void bounds_check_position(int& xpos, int& ypos);
-
-       //! Function to invalidate all tiles.
-       void invalidate_all();
 
        //! Scrolls the display by xmov,ymov pixels.
        //! Invalidation and redrawing will be scheduled.

Modified: trunk/src/game_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_display.cpp?rev=27420&r1=27419&r2=27420&view=diff
==============================================================================
--- trunk/src/game_display.cpp (original)
+++ trunk/src/game_display.cpp Mon Jun 23 00:13:21 2008
@@ -888,15 +888,6 @@
        return calculate_energy_bar(surf);
 }
 
-bool game_display::invalidate(const gamemap::location& loc)
-{
-       if(!invalidateAll_) {
-               bool tmp = invalidated_.insert(loc).second;
-               return tmp;
-       }
-       return false;
-}
-
 void game_display::invalidate_animations_location(const gamemap::location& 
loc) {
        if (map_.is_village(loc)) {
                const int owner = player_teams::village_owner(loc);

Modified: trunk/src/game_display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_display.hpp?rev=27420&r1=27419&r2=27420&view=diff
==============================================================================
--- trunk/src/game_display.hpp (original)
+++ trunk/src/game_display.hpp Mon Jun 23 00:13:21 2008
@@ -102,9 +102,6 @@
 
        //! Draws the movement info (turns available) for a given location.
        void draw_movement_info(const gamemap::location& loc);
-
-       //! Function to invalidate a specific tile for redrawing.
-       bool invalidate(const gamemap::location& loc);
 
        const gamestatus &get_game_status() { return status_; }
        void draw_report(reports::TYPE report_num);




Related Messages


Powered by MHonArc, Updated Mon Jun 23 03:21:04 2008