stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus/src/pathfinder astar.c


From: Russell Smith
Subject: [Stratagus-CVS] stratagus/src/pathfinder astar.c
Date: Tue, 02 Sep 2003 08:51:46 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Russell Smith <address@hidden>  03/09/02 08:51:45

Modified files:
        src/pathfinder : astar.c 

Log message:
        Fix unit always moving before attacking/building/repairing

Patches:
Index: stratagus/src/pathfinder/astar.c
diff -u stratagus/src/pathfinder/astar.c:1.49 
stratagus/src/pathfinder/astar.c:1.50
--- stratagus/src/pathfinder/astar.c:1.49       Sun Aug 31 04:01:20 2003
+++ stratagus/src/pathfinder/astar.c    Tue Sep  2 08:51:45 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: astar.c,v 1.49 2003/08/31 08:01:20 mr-russ Exp $
+//     $Id: astar.c,v 1.50 2003/09/02 12:51:45 mr-russ Exp $
 
 //@{
 
@@ -299,6 +299,12 @@
     Unit* goal;
 
     cost=0;
+
+    // Doesn't cost anything to move to ourselves :)
+    // Used when marking goals mainly.  Could cause speed problems
+    if( unit->X == ex && unit->Y == ey ) {
+       return 0;
+    }
     j=TheMap.Fields[ex+ey*TheMap.Width].Flags&mask;
     if( j && (AStarKnowUnknown
            || IsMapFieldExplored(unit->Player,ex,ey)) ) {




reply via email to

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