Author: sveinung
Date: Wed Jul  8 14:06:40 2015
New Revision: 29201

URL: http://svn.gna.org/viewcvs/freeciv?rev=29201&view=rev
Log:
Cache fake actions for local DiplRel

Cache if a unit is able to perform any action at all (ACTION_ANY) and if it
is able to perform any hostile action (ACTION_HOSTILE) given each local
DiplRel.

See patch #6123

Modified:
    branches/S2_6/common/unittype.c

Modified: branches/S2_6/common/unittype.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/unittype.c?rev=29201&r1=29200&r2=29201&view=diff
==============================================================================
--- branches/S2_6/common/unittype.c     (original)
+++ branches/S2_6/common/unittype.c     Wed Jul  8 14:06:40 2015
@@ -353,7 +353,7 @@
 
 /* Caches for each unit type */
 static bv_ustate_act_cache ustate_act_cache[U_LAST][ACTION_AND_FAKES];
-static bv_diplrel_all_reqs dipl_rel_action_cache[U_LAST][ACTION_COUNT];
+static bv_diplrel_all_reqs dipl_rel_action_cache[U_LAST][ACTION_AND_FAKES];
 
 /**************************************************************************
   Cache if any action may be possible for a unit of the type putype for
@@ -440,6 +440,8 @@
   action_iterate(action_id) {
     BV_CLR_ALL(dipl_rel_action_cache[putype_id][action_id]);
   } action_iterate_end;
+  BV_CLR_ALL(dipl_rel_action_cache[putype_id][ACTION_ANY]);
+  BV_CLR_ALL(dipl_rel_action_cache[putype_id][ACTION_HOSTILE]);
 
   if (!is_actor_unit_type(putype)) {
     /* Not an actor unit. */
@@ -470,11 +472,23 @@
           BV_SET(dipl_rel_action_cache[putype_id][enabler->action],
                  requirement_diplrel_ereq(req.source.value.diplrel,
                                           REQ_RANGE_LOCAL, TRUE));
+          BV_SET(dipl_rel_action_cache[putype_id][ACTION_HOSTILE],
+                 requirement_diplrel_ereq(req.source.value.diplrel,
+                                          REQ_RANGE_LOCAL, TRUE));
+          BV_SET(dipl_rel_action_cache[putype_id][ACTION_ANY],
+                 requirement_diplrel_ereq(req.source.value.diplrel,
+                                          REQ_RANGE_LOCAL, TRUE));
         }
 
         req.present = FALSE;
         if (!does_req_contradicts_reqs(&req, &(enabler->actor_reqs))) {
           BV_SET(dipl_rel_action_cache[putype_id][enabler->action],
+              requirement_diplrel_ereq(req.source.value.diplrel,
+                                       REQ_RANGE_LOCAL, FALSE));
+          BV_SET(dipl_rel_action_cache[putype_id][ACTION_HOSTILE],
+              requirement_diplrel_ereq(req.source.value.diplrel,
+                                       REQ_RANGE_LOCAL, FALSE));
+          BV_SET(dipl_rel_action_cache[putype_id][ACTION_ANY],
               requirement_diplrel_ereq(req.source.value.diplrel,
                                        REQ_RANGE_LOCAL, FALSE));
         }


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

Reply via email to