Complete.Org: Mailing Lists: Archives: freeciv-ai: November 2002:
[freeciv-ai] Re: [Freeciv-Dev] (PR#2272) Explorer
Home

[freeciv-ai] Re: [Freeciv-Dev] (PR#2272) Explorer

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: [Freeciv-Dev] (PR#2272) Explorer
From: "Gregory Berkolaiko via RT" <rt@xxxxxxxxxxxxxx>
Date: Mon, 11 Nov 2002 09:28:29 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Wed, 6 Nov 2002, Raimar Falke via RT wrote:

> 
> 
> Auto explorers don't show the X anymore but have an yellow A.

This is a GUI issue, so better someone else fix it.

> Auto explorers don't disable themselfs anymore after they discovered the
> whole island.

The problem is resetting punit->ai.control.  Can be done in many places, 
but I feel the best is in handle_unit_activity_dependencies.

A patch is attached (against CVS).  It's really 3 lines, but had to format 
a paragraph.

G.

? dip.gz
? ggg.gz
? oops.gz
? ai/aidiplomat.c
? ai/aidiplomat.h
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.238
diff -u -r1.238 unithand.c
--- server/unithand.c   7 Nov 2002 15:45:06 -0000       1.238
+++ server/unithand.c   11 Nov 2002 17:20:45 -0000
@@ -1196,18 +1196,28 @@
 {
   switch (punit->activity) {
   case ACTIVITY_IDLE:
-    if (old_activity == ACTIVITY_PILLAGE) {
-      enum tile_special_type prereq =
+    switch (old_activity) {
+    case ACTIVITY_PILLAGE: 
+      {
+        enum tile_special_type prereq =
          map_get_infrastructure_prerequisite(old_target);
-      if (prereq != S_NO_SPECIAL) {
-       unit_list_iterate (map_get_tile(punit->x, punit->y)->units, punit2)
-         if ((punit2->activity == ACTIVITY_PILLAGE) &&
-             (punit2->activity_target == prereq)) {
-           set_unit_activity(punit2, ACTIVITY_IDLE);
-           send_unit_info(NULL, punit2);
-         }
-       unit_list_iterate_end;
+        if (prereq != S_NO_SPECIAL) {
+          unit_list_iterate (map_get_tile(punit->x, punit->y)->units, punit2)
+            if ((punit2->activity == ACTIVITY_PILLAGE) &&
+                (punit2->activity_target == prereq)) {
+              set_unit_activity(punit2, ACTIVITY_IDLE);
+              send_unit_info(NULL, punit2);
+            }
+          unit_list_iterate_end;
+        }
+        break;
       }
+    case ACTIVITY_EXPLORE:
+      /* Restore unit's control status */
+      punit->ai.control = FALSE;
+      break;
+    default: 
+      /* do nothing */
     }
     break;
   case ACTIVITY_EXPLORE:

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