Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#9885) AI diplomat moves
Home

[Freeciv-Dev] (PR#9885) AI diplomat moves

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9885) AI diplomat moves
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Tue, 31 Aug 2004 09:46:12 -0700
Reply-to: rt@xxxxxxxxxxx

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

Currently, in ai_unit_move(), we call void handle_unit_move() to process
our moves. This function only does redundant error checks and then calls
bool handle_unit_move_request(). I originally used the former because it
was higher level, but now I see this has caused a subtle bug: AI diplomats
refuse to move through allied cities.

The attached patch fixes this by calling handle_unit_move_request() with
the appropriate parameters set.

  - Per

Index: ai/aitools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aitools.c,v
retrieving revision 1.121
diff -u -r1.121 aitools.c
--- ai/aitools.c        31 Aug 2004 15:35:31 -0000      1.121
+++ ai/aitools.c        31 Aug 2004 16:43:13 -0000
@@ -490,7 +490,7 @@
   assert(is_tiles_adjacent(punit->x, punit->y, x, y));
 
   handle_unit_activity_request(punit, ACTIVITY_IDLE);
-  handle_unit_move(unit_owner(punit), punit->id,x,y);
+  (void) handle_unit_move_request(punit, x, y, FALSE, FALSE);
   alive = (find_unit_by_id(sanity) != NULL);
 
   if (alive && same_pos(x, y, punit->x, punit->y)
@@ -555,7 +555,7 @@
 
   /* go */
   handle_unit_activity_request(punit, ACTIVITY_IDLE);
-  handle_unit_move(unit_owner(punit), punit->id, x, y);
+  (void) handle_unit_move_request(punit, x, y, FALSE, TRUE);
 
   /* handle the results */
   if (find_unit_by_id(sanity) && same_pos(x, y, punit->x, punit->y)) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9885) AI diplomat moves, Per I. Mathisen <=