Author: sveinung
Date: Sun Aug  9 15:12:35 2015
New Revision: 29420

URL: http://svn.gna.org/viewcvs/freeciv?rev=29420&view=rev
Log:
Consider hard coded unit type action requirements

when reasoning about what actions a unit may be able to perform.

See patch #6196

Modified:
    trunk/common/unittype.c

Modified: trunk/common/unittype.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unittype.c?rev=29420&r1=29419&r2=29420&view=diff
==============================================================================
--- trunk/common/unittype.c     (original)
+++ trunk/common/unittype.c     Sun Aug  9 15:12:35 2015
@@ -291,9 +291,10 @@
   /* See if the unit type can do an action controlled by generalized action
    * enablers */
   action_enablers_iterate(enabler) {
-    if (requirement_fulfilled_by_unit_type(putype,
-                                           &(enabler->actor_reqs))
-        && action_get_actor_kind(enabler->action) == AAK_UNIT) {
+    if (action_get_actor_kind(enabler->action) == AAK_UNIT
+        && action_actor_utype_hard_reqs_ok(enabler->action, putype)
+        && requirement_fulfilled_by_unit_type(putype,
+                                              &(enabler->actor_reqs))) {
       log_debug("act_cache: %s can %s",
                 utype_rule_name(putype), gen_action_name(enabler->action));
       BV_SET(unit_can_act_cache[enabler->action], utype_index(putype));
@@ -621,6 +622,11 @@
                               const int move_fragments)
 {
   struct range *ml_range;
+
+  if (!is_actor_unit_type(punit_type)) {
+    /* Not an actor unit. */
+    return FALSE;
+  }
 
   if (action_get_actor_kind(action_id) != AAK_UNIT) {
     /* This action isn't performed by any unit at all so this unit type


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

Reply via email to