[Freeciv-Dev] (PR#10916) AI ferries double move when delivering

"Benedict Adamson" <[email protected]>
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10916 >

To try and understand what is happening, I added some logging 
information (see the attached patch). It seems that the ferry moves_left 
field is correct.

Perhaps this a problem with interaction between server and client, 
rather than a problem with the server? Is the server sending data to the 
clients at the wrong time, when the player is an AI?

I'm mystified.
PR10916,981,2.0.0beta3.patch (text/x-patch, 2.3 KB)
diff -ru -Xfreeciv.PR10916/diff_ignore vendor.freeciv.beta/ai/aiferry.c freeciv.PR10916/ai/aiferry.c
--- vendor.freeciv.beta/ai/aiferry.c	2004-10-22 22:48:23.000000000 +0100
+++ freeciv.PR10916/ai/aiferry.c	2004-11-07 16:33:28.000000000 +0000
@@ -304,7 +304,7 @@
   struct pf_map *search_map;
 
 
-  UNIT_LOG(LOGLEVEL_FINDFERRY, punit, "asked find_ferry for a boat");
+  UNIT_LOG(LOGLEVEL_FINDFERRY, punit, "asked aiferry_find_boat for a boat");
 
   if (aiferry_avail_boats(unit_owner(punit)) <= 0 
       && punit->ai.ferryboat <= 0) {
@@ -343,9 +343,9 @@
           
           if (turns < best_turns) {
             UNIT_LOG(LOGLEVEL_FINDFERRY, punit, 
-                     "Found a potential boat %s[%d](%d,%d)",
+                     "Found a potential boat %s[%d](%d,%d)(moves left: %d)",
                      unit_type(aunit)->name, aunit->id, aunit->tile->x,
-		     aunit->tile->y);
+		     aunit->tile->y, aunit->moves_left);
 	    if (path) {
 	      *path = pf_next_get_path(search_map);
 	    }
@@ -542,7 +542,8 @@
       return FALSE;
     }
 
-    UNIT_LOG(LOGLEVEL_GOBYBOAT, punit, "Our boat has arrived");
+    UNIT_LOG(LOGLEVEL_GOBYBOAT, punit, "Our boat has arrived "
+	     "[%d](moves left: %d)", ferryboat->id, ferryboat->moves_left);
     handle_unit_activity_request(punit, ACTIVITY_IDLE);
   }
 
@@ -824,7 +825,8 @@
      return;
   }
 
-  UNIT_LOG(LOGLEVEL_FERRY, punit, "Ferryboat is not carrying anyone.");
+  UNIT_LOG(LOGLEVEL_FERRY, punit, "Ferryboat is not carrying anyone "
+	   "(moves left: %d).", punit->moves_left);
   aiferry_make_available(punit);
   handle_unit_activity_request(punit, ACTIVITY_IDLE);
   ai_unit_new_role(punit, AIUNIT_NONE, NULL);
@@ -832,7 +834,8 @@
 
   /* Try to find passengers */
   if (aiferry_findcargo(punit)) {
-    UNIT_LOG(LOGLEVEL_FERRY, punit, "picking up cargo");
+    UNIT_LOG(LOGLEVEL_FERRY, punit, "picking up cargo (moves left: %d)",
+	     punit->moves_left);
     ai_unit_goto(punit, punit->goto_tile);
     return;
   }
diff -ru -Xfreeciv.PR10916/diff_ignore vendor.freeciv.beta/diff_ignore freeciv.PR10916/diff_ignore
--- vendor.freeciv.beta/diff_ignore	2004-10-22 22:48:23.000000000 +0100
+++ freeciv.PR10916/diff_ignore	2004-11-07 16:35:52.000000000 +0000
@@ -17,6 +17,7 @@
 *~
 .#*
 .deps
+.svn
 CVS
 Freeciv.h
 Makefile
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.