JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
oops, fixed off-by-one error in new_engine_dots
authorJoshua Grams <josh@qualdan.com>
Sun, 10 Jul 2005 20:55:04 +0000 (20:55 +0000)
committerJoshua Grams <josh@qualdan.com>
Sun, 10 Jul 2005 20:55:04 +0000 (20:55 +0000)
main.c

diff --git a/main.c b/main.c
index d9e81ef..258ecd3 100644 (file)
--- a/main.c
+++ b/main.c
@@ -230,9 +230,10 @@ draw_engine_dots(SDL_Surface *s) {
                if(edot[i].active) {
                        edot[i].x += edot[i].dx*t_frame - xscroll;
                        edot[i].y += edot[i].dy*t_frame - yscroll;
-                       if((edot[i].life -= t_frame*3)<0 || edot[i].y<0 || edot[i].y>YSIZE) {
-                               edot[i].active = 0;
-                       } else if(edot[i].x<0 || edot[i].x>XSIZE) {
+                       edot[i].life -= t_frame*3;
+                       if(edot[i].life < 0
+                                       || edot[i].y<0 || edot[i].y >= YSIZE
+                                       || edot[i].x<0 || edot[i].x >= XSIZE) {
                                edot[i].active = 0;
                        } else {
                                int heatindex;
@@ -275,7 +276,7 @@ new_engine_dots(int n, int dir) {
                                dotptr->life = 60 * fabs(dx);
                        }
 
-                       if(dotptr - edot < MAXENGINEDOTS) dotptr++;
+                       if(dotptr - edot < MAXENGINEDOTS-1) dotptr++;
                        else dotptr = edot;
                }
        }