Complete.Org: Mailing Lists: Archives: freeciv-ai: June 2004:
[freeciv-ai] (PR#8955) aitools.c:821: ai_unit_move
Home

[freeciv-ai] (PR#8955) aitools.c:821: ai_unit_move

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [freeciv-ai] (PR#8955) aitools.c:821: ai_unit_move
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Tue, 15 Jun 2004 10:42:21 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8955 >

ai_unit_execute_path wasn't taught to handle paths with danger in it.
Now that arctic is dangerous (a very dubious development in itself),
execute_path has to be adjusted.  Which is done in the attached path.

G.
Index: ai/aitools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aitools.c,v
retrieving revision 1.110
diff -u -r1.110 aitools.c
--- ai/aitools.c        14 Jun 2004 10:36:39 -0000      1.110
+++ ai/aitools.c        15 Jun 2004 17:37:53 -0000
@@ -95,7 +95,6 @@
 
 /*************************************************************************
   This is a function to execute paths returned by the path-finding engine.
-  It is analogous to goto_route_execute, only much simpler.
 
   Brings our bodyguard along.
   Returns FALSE only if died.
@@ -109,6 +108,11 @@
     int x = path->positions[i].x, y = path->positions[i].y;
     int id = punit->id;
 
+    if (same_pos(punit->x, punit->y, x, y)) {
+      UNIT_LOG(LOG_DEBUG, punit, "execute_path: waiting this turn");
+      return TRUE;
+    }
+
     /* We use ai_unit_move() for everything but the last step
      * of the way so that we abort if unexpected opposition
      * shows up. Any enemy on the target tile is expected to

[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] (PR#8955) aitools.c:821: ai_unit_move, Gregory Berkolaiko <=