Author: sveinung
Date: Thu Apr  6 10:19:12 2017
New Revision: 35210

URL: http://svn.gna.org/viewcvs/freeciv?rev=35210&view=rev
Log:
Detect city blocks unit stack tgt action.

Don't offer to do a unit stack targeted action against the units that may be
hidden in a city when the action can't be done to unit stacks inside a city.

See hrm Feature #650074

Modified:
    trunk/common/actions.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=35210&r1=35209&r2=35210&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Thu Apr  6 10:19:12 2017
@@ -3194,6 +3194,18 @@
     return ACTPROB_IMPOSSIBLE;
   }
 
+  /* Doesn't leak information since the actor player can see the target
+   * tile. */
+  if (tile_is_seen(target_tile, unit_owner(actor_unit))
+      && tile_city(target_tile) != NULL
+      && !utype_can_do_act_if_tgt_citytile(unit_type_get(actor_unit),
+                                           action_id,
+                                           CITYT_CENTER, TRUE)) {
+    /* Don't offer to perform actions that never can target a unit stack in
+     * a city. */
+    return ACTPROB_IMPOSSIBLE;
+  }
+
   /* Does the player know if there are units at the tile? Must be done here
    * since an empthy unseen tile will result in false. */
   if (!can_player_see_hypotetic_units_at(unit_owner(actor_unit),


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

Reply via email to