Author: boucman
Date: Mon Jun 16 19:36:28 2008
New Revision: 27228

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27228&view=rev
Log:
fix to unit decapitation when moving up/down, thx to alink for spoting it

Modified:
    trunk/src/display.cpp

Modified: trunk/src/display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.cpp?rev=27228&r1=27227&r2=27228&view=diff
==============================================================================
--- trunk/src/display.cpp (original)
+++ trunk/src/display.cpp Mon Jun 16 19:36:28 2008
@@ -2022,6 +2022,7 @@
                reportSurfaces_[report_num].assign(NULL);
        }
 }
+extern int debug;
 bool display::invalidate_rectangle(const gamemap::location& first_corner, 
const gamemap::location& second_corner) {
        // unused variable - const SDL_Rect& rect = map_area();
        bool result = false;
@@ -2029,6 +2030,12 @@
                for (int y = minimum<int>(first_corner.y,second_corner.y); y <= 
maximum<int>(first_corner.y,second_corner.y);y++) {
                        result |= invalidate(gamemap::location(x,y));
                }
+               // take a margin on Y because of "misaligned hexes" 
+               if(is_odd(x)) {
+                       result |= 
invalidate(gamemap::location(x,minimum<int>(first_corner.y,second_corner.y)-1));
+               } else {
+                       result |= 
invalidate(gamemap::location(x,minimum<int>(first_corner.y,second_corner.y)+1));
+               }
        }
        return result;
 }
@@ -2038,7 +2045,6 @@
        return invalidate_rectangle(pixel_position_to_hex(x1 - rect.x+xpos_, y1 
- rect.y+ypos_),pixel_position_to_hex(x2 - rect.x+xpos_, y2 - rect.y+ypos_));
 }
 bool display::rectangle_need_update(const gamemap::location& first_corner, 
const gamemap::location& second_corner) const {
-       // unused variable - const SDL_Rect& rect = map_area();
        for (int x = minimum<int>(first_corner.x,second_corner.x); x <= 
maximum<int>(first_corner.x,second_corner.x);x++) {
                for (int y = minimum<int>(first_corner.y,second_corner.y); y <= 
maximum<int>(first_corner.y,second_corner.y);y++) {
                        if(invalidated_.find(gamemap::location(x,y)) != 
invalidated_.end()) return true;


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

Reply via email to