Author: sveinung
Date: Sun Apr 12 02:23:54 2015
New Revision: 28763

URL: http://svn.gna.org/viewcvs/freeciv?rev=28763&view=rev
Log:
Fix unit state legality hostile actions cache.

Patch #5975 gave it a location and cleared it on initialization but didn't write
to it when a unit state permitted a hostile action. This made it look like
hostile actions always were forbidden in every unit state. Fix it by registering
what unit states allow a hostile action.

See bug #23464

Modified:
    trunk/common/unittype.c

Modified: trunk/common/unittype.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unittype.c?rev=28763&r1=28762&r2=28763&view=diff
==============================================================================
--- trunk/common/unittype.c     (original)
+++ trunk/common/unittype.c     Sun Apr 12 02:23:54 2015
@@ -407,6 +407,11 @@
           BV_SET(ustate_act_cache[utype_index(putype)][enabler->action],
               requirement_unit_state_ereq(req.source.value.unit_state,
                                          TRUE));
+          if (action_is_hostile(enabler->action)) {
+            BV_SET(ustate_act_cache[utype_index(putype)][ACTION_HOSTILE],
+                requirement_unit_state_ereq(req.source.value.unit_state,
+                                           TRUE));
+          }
         }
 
         /* Not required to be present, so OK if absent */
@@ -418,6 +423,11 @@
           BV_SET(ustate_act_cache[utype_index(putype)][enabler->action],
                  requirement_unit_state_ereq(req.source.value.unit_state,
                                             FALSE));
+          if (action_is_hostile(enabler->action)) {
+            BV_SET(ustate_act_cache[utype_index(putype)][ACTION_HOSTILE],
+                   requirement_unit_state_ereq(req.source.value.unit_state,
+                                              FALSE));
+          }
         }
       }
     } action_enablers_iterate_end;


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

Reply via email to