Author: sveinung
Date: Fri Dec 12 05:09:16 2014
New Revision: 27262

URL: http://svn.gna.org/viewcvs/freeciv?rev=27262&view=rev
Log:
AI: Don't treat an actor incapable of doing hostile actions like a spy.

Check if the unit type can do hostile actions in stead of if it can act.

See bug #23050

Modified:
    trunk/ai/default/advmilitary.c
    trunk/ai/default/aidiplomat.c
    trunk/ai/default/aihunt.c

Modified: trunk/ai/default/advmilitary.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/advmilitary.c?rev=27262&r1=27261&r2=27262&view=diff
==============================================================================
--- trunk/ai/default/advmilitary.c      (original)
+++ trunk/ai/default/advmilitary.c      Fri Dec 12 05:09:16 2014
@@ -560,7 +560,7 @@
       struct unit_type_ai *utai = utype_ai_data(utype, ait);
 
       if (!utai->carries_occupiers
-          && !is_actor_unit_type(utype)
+          && !utype_acts_hostile(utype)
           && (utype_has_flag(utype, UTYF_CIVILIAN)
               || (0 >= utype->attack_strength
                   && !uclass_has_flag(utype_class(utype),
@@ -594,7 +594,7 @@
       (void) dai_wants_defender_against(ait, pplayer, pcity, utype,
                                         vulnerability / MAX(move_time, 1));
 
-      if (is_actor_unit(punit) && 2 >= move_time) {
+      if (utype_acts_hostile(unit_type(punit)) && 2 >= move_time) {
         city_data->diplomat_threat = TRUE;
       }
 

Modified: trunk/ai/default/aidiplomat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aidiplomat.c?rev=27262&r1=27261&r2=27262&view=diff
==============================================================================
--- trunk/ai/default/aidiplomat.c       (original)
+++ trunk/ai/default/aidiplomat.c       Fri Dec 12 05:09:16 2014
@@ -413,7 +413,7 @@
     }
     unit_list_iterate(ptile->units, punit) {
       if (unit_owner(punit) == pplayer &&
-          is_actor_unit(punit)) {
+          utype_acts_hostile(unit_type(punit))) {
         return TRUE;
       }
     } unit_list_iterate_end;

Modified: trunk/ai/default/aihunt.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aihunt.c?rev=27262&r1=27261&r2=27262&view=diff
==============================================================================
--- trunk/ai/default/aihunt.c   (original)
+++ trunk/ai/default/aihunt.c   Fri Dec 12 05:09:16 2014
@@ -385,7 +385,7 @@
       *stackcost += 1000;
       *stackthreat += 5000;
     }
-    if (is_actor_unit(sucker)) {
+    if (utype_acts_hostile(unit_type(sucker))) {
       *stackthreat += 500; /* extra threatening */
     }
     *stackcost += unit_build_shield_cost(sucker);
@@ -461,7 +461,7 @@
          * of each turn. */
         continue;
       }
-      if (!is_actor_unit(target)
+      if (!utype_acts_hostile(unit_type(target))
           && get_transporter_capacity(target) == 0
           && !unit_has_type_flag(target, UTYF_GAMELOSS)) {
         /* Won't hunt this one. */


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

Reply via email to