Author: sveinung
Date: Thu Apr  6 10:20:39 2017
New Revision: 35213

URL: http://svn.gna.org/viewcvs/freeciv?rev=35213&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:
    branches/S3_0/common/actions.c

Modified: branches/S3_0/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/actions.c?rev=35213&r1=35212&r2=35213&view=diff
==============================================================================
--- branches/S3_0/common/actions.c      (original)
+++ branches/S3_0/common/actions.c      Thu Apr  6 10:20:39 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