[AD] rotate.c hang fix

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Compiled and running on Mac OS X 10.2.6, game atanks 0.9.8g running on top
of Allegro 4.1.11 repeatedly stuck hanging with a missile at it's flight
zenith. I traced the bug into Allegro's rotate.c, function
_parallelogram_map, and although I didn't quite understand what the code
did, I came up with the accompanied fix to situations when spr_dx equals
zero, and thusly a while loop never exits.

Thanks for the library. 

-- 
Information Shepherd Kalle Toivonen, kato@xxxxxxxxxx, 041-5053073
"The reasonable man adapts himself to the world;
the unreasonable one persists in trying to adapt the world to himself.
Therefore all progress depends on the unreasonable man." -- GB Shaw
--- /home/kato/prj/allegro-4.1.11/src/rotate.c	Mon Jun 30 02:27:03 2003
+++ src/rotate.c	Fri Aug  8 00:25:24 2003
@@ -510,7 +510,8 @@
 	       though.
 	    */
 	    if ((unsigned)(l_spr_x_rounded >> 16) >= (unsigned)spr->w) {
-	       if ((l_spr_x_rounded < 0) == (spr_dx < 0)) {
+	       if (((l_spr_x_rounded < 0) == (spr_dx < 0)) ||
+		   (spr_dx == 0)) {
 		  /* This can happen. */
 		  goto skip_draw;
 	       }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/