Author: sveinung
Date: Wed Nov  9 02:38:22 2016
New Revision: 34448

URL: http://svn.gna.org/viewcvs/freeciv?rev=34448&view=rev
Log:
ai: any hostile unit != any hostile diplomat.

Freeciv 3.0 has hostile enabler controlled actions that aren't diplomatic.
The function is_city_surrounded_by_our_spies() is used when the Diplomat/Spy
control code checks if a new Diplomat/Spy is needed.

Stop assuming that any unit capable of performing any hostile action is
capable of performing a hostile Spy/Diplomat action in the function
is_city_surrounded_by_our_spies().

See bug #25272

Modified:
    trunk/ai/default/aidiplomat.c

Modified: trunk/ai/default/aidiplomat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aidiplomat.c?rev=34448&r1=34447&r2=34448&view=diff
==============================================================================
--- trunk/ai/default/aidiplomat.c       (original)
+++ trunk/ai/default/aidiplomat.c       Wed Nov  9 02:38:22 2016
@@ -467,8 +467,27 @@
       continue;
     }
     unit_list_iterate(ptile->units, punit) {
-      if (unit_owner(punit) == pplayer &&
-          utype_acts_hostile(unit_type_get(punit))) {
+      if (unit_owner(punit) == pplayer
+          && (utype_can_do_action(unit_type_get(punit),
+                                  ACTION_SPY_INVESTIGATE_CITY)
+              || utype_can_do_action(unit_type_get(punit),
+                                     ACTION_SPY_POISON)
+              || utype_can_do_action(unit_type_get(punit),
+                                     ACTION_SPY_STEAL_GOLD)
+              || utype_can_do_action(unit_type_get(punit),
+                                     ACTION_SPY_SABOTAGE_CITY)
+              || utype_can_do_action(unit_type_get(punit),
+                                     ACTION_SPY_TARGETED_SABOTAGE_CITY)
+              || utype_can_do_action(unit_type_get(punit),
+                                     ACTION_SPY_STEAL_TECH)
+              || utype_can_do_action(unit_type_get(punit),
+                                     ACTION_SPY_TARGETED_STEAL_TECH)
+              || utype_can_do_action(unit_type_get(punit),
+                                     ACTION_SPY_INCITE_CITY)
+              || utype_can_do_action(unit_type_get(punit),
+                                     ACTION_SPY_BRIBE_UNIT)
+              || utype_can_do_action(unit_type_get(punit),
+                                     ACTION_SPY_SABOTAGE_UNIT))) {
         return TRUE;
       }
     } unit_list_iterate_end;


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to