Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#4750) Patch: Exploring units stop when they see a hut
Home

[Freeciv-Dev] (PR#4750) Patch: Exploring units stop when they see a hut

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rt-guest@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#4750) Patch: Exploring units stop when they see a hut
From: "Ciaran Mac Lochlainn" <ciaran17@xxxxxxxxxx>
Date: Sun, 15 Aug 2004 15:54:06 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch changes ai_manage_explorer so that exploring units will 
stop when they see a hut.

TODO:
- Exploring units should stop when they see an enemy (non-allied?) 
unit or city.


Index: aiexplorer.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiexplorer.c,v
retrieving revision 1.2
diff -u -r1.2 aiexplorer.c
--- aiexplorer.c        13 Aug 2004 15:59:11 -0000      1.2
+++ aiexplorer.c        15 Aug 2004 22:05:13 -0000
@@ -15,6 +15,8 @@
 #include <config.h>
 #endif
 
+#include "fcintl.h"
+
 #include "log.h"
 #include "player.h"
 #include "unit.h"
@@ -23,6 +25,7 @@
 #include "pf_tools.h"
 
 #include "maphand.h"
+#include "plrhand.h"
 
 #include "ailog.h"
 #include "aitools.h"
@@ -287,7 +290,20 @@
     struct pf_position pos;
 
     pf_next_get_position(map, &pos);
-    
+
+    if (!pplayer->ai.control &&
+       is_tiles_adjacent(pos.x, pos.y, x, y)) {
+    /* Stop exploring under certain conditions - for human players */
+
+        /* Stop exploring when the unit sees a hut */
+      if (map_has_special(pos.x, pos.y, S_HUT)) {
+        notify_player_ex(pplayer, x, y, E_UNIT_ORDERS,
+                      _("Game: Your %s found a hut."),
+                      unit_name(punit->type));
+        return FALSE;
+      }
+    }
+
     /* Our callback should insure this. */
     assert(map_is_known(pos.x, pos.y, pplayer));
     

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