Author: sveinung
Date: Wed Dec 10 13:54:04 2014
New Revision: 27228

URL: http://svn.gna.org/viewcvs/freeciv?rev=27228&view=rev
Log:
Path finding: Be precise when classifying a unit as a diplomat or trader.

A unit that is able to perform a caravan actions but no spy action isn't a
diplomat. A unit that has the TradeRoute unit flag but is unable to establish a
trade route or enter a marketplace isn't a trader.

See patch #5509

Modified:
    trunk/common/aicore/pf_tools.c

Modified: trunk/common/aicore/pf_tools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/aicore/pf_tools.c?rev=27228&r1=27227&r2=27228&view=diff
==============================================================================
--- trunk/common/aicore/pf_tools.c      (original)
+++ trunk/common/aicore/pf_tools.c      Wed Dec 10 13:54:04 2014
@@ -684,12 +684,27 @@
   }
   if (is_actor_unit_type(parameter->utype)) {
     /* FIXME: it should consider action enablers. */
-    parameter->actions |= PF_AA_DIPLOMAT;
-    parameter->get_action = pf_get_action;
-    parameter->is_action_possible = pf_action_possible;
-  }
-  if (utype_has_flag(parameter->utype, UTYF_TRADE_ROUTE)) {
-    parameter->actions |= PF_AA_TRADE_ROUTE;
+    if (utype_can_do_action(parameter->utype, ACTION_TRADE_ROUTE)
+        || utype_can_do_action(parameter->utype, ACTION_MARKETPLACE)) {
+      parameter->actions |= PF_AA_TRADE_ROUTE;
+    }
+    if (utype_can_do_action(parameter->utype, ACTION_SPY_POISON)
+        || utype_can_do_action(parameter->utype, ACTION_SPY_SABOTAGE_UNIT)
+        || utype_can_do_action(parameter->utype, ACTION_SPY_BRIBE_UNIT)
+        || utype_can_do_action(parameter->utype, ACTION_SPY_SABOTAGE_CITY)
+        || utype_can_do_action(parameter->utype,
+                               ACTION_SPY_TARGETED_SABOTAGE_CITY)
+        || utype_can_do_action(parameter->utype, ACTION_SPY_INCITE_CITY)
+        || utype_can_do_action(parameter->utype, ACTION_SPY_STEAL_TECH)
+        || utype_can_do_action(parameter->utype,
+                               ACTION_SPY_TARGETED_STEAL_TECH)
+        || utype_can_do_action(parameter->utype, ACTION_SPY_STEAL_GOLD)
+        || utype_can_do_action(parameter->utype,
+                               ACTION_SPY_INVESTIGATE_CITY)
+        || utype_can_do_action(parameter->utype,
+                               ACTION_ESTABLISH_EMBASSY)) {
+      parameter->actions |= PF_AA_DIPLOMAT;
+    }
     parameter->get_action = pf_get_action;
     parameter->is_action_possible = pf_action_possible;
   }


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

Reply via email to