Complete.Org: Mailing Lists: Archives: freeciv-ai: August 2004:
[freeciv-ai] (PR#9808) AI should remove shared vision more often
Home

[freeciv-ai] (PR#9808) AI should remove shared vision more often

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] (PR#9808) AI should remove shared vision more often
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Wed, 25 Aug 2004 07:49:08 -0700
Reply-to: rt@xxxxxxxxxxx

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

AI doesn't share vision with you if it's not safe, but once shared
vision is accepted AI will never remove it even if it became dangerous.
For example if AI's ally give shared vision to someone, who is neutral
to AI.  This may result in vision shared beetwen enemies (and is in fact
very often in auto-games).
I belive that the attached patch helps
--
mateusz
Index: advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.27
diff -u -r1.27 advdiplomacy.c
--- advdiplomacy.c      30 Jul 2004 20:40:49 -0000      1.27
+++ advdiplomacy.c      25 Aug 2004 11:25:09 -0000
@@ -1006,10 +1006,16 @@
     clause.from = pplayer;
     clause.value = 0;
 
-    /* Remove shared vision if we are not allied. */
-    if (!pplayers_allied(pplayer, aplayer)
-        && gives_shared_vision(pplayer, aplayer)) {
-      remove_shared_vision(pplayer, aplayer);
+    /* Remove shared vision if we are not allied or it is no longer safe. */
+    if (gives_shared_vision(pplayer, aplayer)) {
+      if (!pplayers_allied(pplayer, aplayer)) {
+        remove_shared_vision(pplayer, aplayer);
+      } else if (!shared_vision_is_safe(pplayer, aplayer)) {
+        notify(aplayer, _("*%s (AI)* Sorry, sharing vision with you "
+                           "is no longer safe to me"),
+              pplayer->name);
+       remove_shared_vision(pplayer, aplayer);
+      }
     }
 
     /* No peace to enemies of our allies... or pointless peace. */

[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] (PR#9808) AI should remove shared vision more often, Mateusz Stefek <=