pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src spot_map.cxx,1.19,1.20


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src spot_map.cxx,1.19,1.20
Date: 7 Oct 2002 23:53:43 -0000

Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv9923

Modified Files:
        spot_map.cxx 
Log Message:
fixed bug crash bug #696 when pingus explode near the screen border

Index: spot_map.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/spot_map.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- spot_map.cxx        27 Sep 2002 11:26:44 -0000      1.19
+++ spot_map.cxx        7 Oct 2002 23:53:41 -0000       1.20
@@ -244,11 +244,15 @@
 PingusSpotMap::remove(CL_SurfaceProvider* sprovider, int x, int y)
 {
   // Get the start tile and end tile
-  int start_x = x / tile_size;
-  int start_y = y / tile_size;
-  int end_x = (x + sprovider->get_width()) / tile_size;
-  int end_y = (y + sprovider->get_height()) / tile_size;
-      
+  int start_x = Math::max(x / tile_size, 0);
+  int start_y = Math::max(y / tile_size, 0);
+  int end_x   = Math::min((x + sprovider->get_width()) / tile_size, 
+                          static_cast<unsigned int>(width/tile_size));
+  int end_y   = Math::min((y + sprovider->get_height()) / tile_size, 
+                          static_cast<unsigned int>(height/tile_size));
+     
+  
+
   for(int ix = start_x; ix <= end_x; ++ix) 
     {
       for(int iy = start_y; iy <= end_y; ++iy) 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]