stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus doc/ChangeLog.html src/missile/missile.c


From: Russell Smith
Subject: [Stratagus-CVS] stratagus doc/ChangeLog.html src/missile/missile.c
Date: Tue, 02 Dec 2003 19:20:55 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Russell Smith <address@hidden>  03/12/02 19:20:54

Modified files:
        doc            : ChangeLog.html 
        src/missile    : missile.c 

Log message:
        Fixed Bug #6924: missile cast near map border

Patches:
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.588 stratagus/doc/ChangeLog.html:1.589
--- stratagus/doc/ChangeLog.html:1.588  Sun Nov 30 15:03:29 2003
+++ stratagus/doc/ChangeLog.html        Tue Dec  2 19:20:54 2003
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-----   $Id: ChangeLog.html,v 1.588 2003/11/30 20:03:29 jsalmon3 Exp $
+----   $Id: ChangeLog.html,v 1.589 2003/12/03 00:20:54 mr-russ Exp $
 
 ----   (c) Copyright 1998-2003 by Lutz Sammer
 
@@ -36,10 +36,11 @@
 <li>Future 2.00 Release<p>
     <ul>
     <li>++
+    <li>Fixed Bug #6924: missile cast near map border (from Russell Smith).
     <li>Rewrote video using SDL_Surface, enable with -DUSE_SDL_SURFACE (from 
Nehal Mistry).
     <li>Per UnitType limits (from François Beerten)
     <li>Record and check sync info in replay (from Ludovic Pollet)
-    <li>Fixed Bug #6670 Support for keyboards other than QWERTY (from Ludovic 
Pollet)
+    <li>Fixed Bug #6670: Support for keyboards other than QWERTY (from Ludovic 
Pollet)
     <li>AI can use automatically transporters (Task #2852) (from Ludovic 
Pollet)
     <li>Added a map splitter for fast PlaceReachable. (from Ludovic Pollet) 
     <li>Food, replaced with Supply/Demand.  Buildings support demand (from 
Russell Smith).
Index: stratagus/src/missile/missile.c
diff -u stratagus/src/missile/missile.c:1.110 
stratagus/src/missile/missile.c:1.111
--- stratagus/src/missile/missile.c:1.110       Wed Nov 19 19:53:12 2003
+++ stratagus/src/missile/missile.c     Tue Dec  2 19:20:54 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: missile.c,v 1.110 2003/11/20 00:53:12 jsalmon3 Exp $
+//     $Id: missile.c,v 1.111 2003/12/03 00:20:54 mr-russ Exp $
 
 //@{
 
@@ -609,6 +609,7 @@
 local void GetMissileMapArea(const Missile* missile, int* sx, int* sy,
     int* ex, int* ey)
 {
+#define Bound(x, y) (x) < 0 ? 0 : ((x) > (y) ? (y) : (x))
     DebugCheck(missile == NULL);
     DebugCheck(sx == NULL);
     DebugCheck(sy == NULL);
@@ -617,10 +618,11 @@
     DebugCheck(TileSizeX <= 0);
     DebugCheck(TileSizeY <= 0);
     DebugCheck(missile->Type == NULL);
-    *sx = missile->X / TileSizeX;
-    *sy = missile->Y / TileSizeY;
-    *ex = (missile->X + missile->Type->Width) / TileSizeX;
-    *ey = (missile->Y + missile->Type->Height) / TileSizeY;
+    *sx = Bound(missile->X / TileSizeX, TheMap.Width - 1);
+    *sy = Bound(missile->Y / TileSizeY, TheMap.Height - 1);
+    *ex = Bound((missile->X + missile->Type->Width) / TileSizeX, TheMap.Width 
- 1);
+    *ey = Bound((missile->Y + missile->Type->Height) / TileSizeY, 
TheMap.Height - 1);
+#undef Bound
 }
 
 /**
@@ -637,6 +639,8 @@
     int max_x;
     int min_y;
     int max_y;
+    int x;
+    int y;
 
     DebugCheck(vp == NULL);
     DebugCheck(missile == NULL);
@@ -646,11 +650,15 @@
     }
     DebugLevel3Fn("Missile bounding box %d %d %d %d\n" _C_ min_x _C_ max_x _C_
        min_y _C_ max_y);
-    if (!IsMapFieldVisible(ThisPlayer, (missile->X - TileSizeX / 2) / 
TileSizeX,
-           (missile->Y - TileSizeY / 2) / TileSizeY) && !ReplayRevealMap) {
-       return 0;
+
+    for (x = min_x; x <= max_x; ++x) {
+       for ( y = min_y; y <= max_y; ++y) {
+           if (ReplayRevealMap || IsMapFieldVisible(ThisPlayer, x, y)) {
+               return 1;
+           }
+       }
     }
-    return 1;
+    return 0;
 }
 
 /**
@@ -1327,7 +1335,7 @@
 
     DebugCheck(file == NULL);
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.110 
2003/11/20 00:53:12 jsalmon3 Exp $\n\n");
+    CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.111 
2003/12/03 00:20:54 mr-russ Exp $\n\n");
 
     //
     // Original number to internal missile-type name.
@@ -1436,7 +1444,7 @@
 
     DebugCheck(file == NULL);
     CLprintf(file,"\n;;; -----------------------------------------\n");
-    CLprintf(file,";;; MODULE: missiles $Id: missile.c,v 1.110 2003/11/20 
00:53:12 jsalmon3 Exp $\n\n");
+    CLprintf(file,";;; MODULE: missiles $Id: missile.c,v 1.111 2003/12/03 
00:20:54 mr-russ Exp $\n\n");
 
     for (missiles = GlobalMissiles; *missiles; ++missiles) {
        SaveMissile(*missiles, file);




reply via email to

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