Author: sveinung
Date: Thu Jun 30 10:28:12 2016
New Revision: 33120

URL: http://svn.gna.org/viewcvs/freeciv?rev=33120&view=rev
Log:
No self targeted action to neighbor tile.

Don't propose self target actions when the user is targeting a neighboring
tile.

Requested by Marko Lindqvist <cazfi>

See bug #24798

Modified:
    trunk/server/unithand.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=33120&r1=33119&r2=33120&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Thu Jun 30 10:28:12 2016
@@ -1202,6 +1202,8 @@
   struct unit *target_unit;
   struct city *target_city;
 
+  bool is_same_tile;
+
   /* No potentially legal action is known yet. If none is found the player
    * should get an explanation. */
   bool at_least_one_action = FALSE;
@@ -1247,6 +1249,9 @@
     /* Prepare the client selected target city. */
     target_city = game_city_by_number(target_city_id_client);
   }
+
+  /* Is the actor asking about actions against his own tile? */
+  is_same_tile = unit_tile(actor_unit) == target_tile;
 
   /* Find out what can be done to the targets. */
 
@@ -1270,7 +1275,9 @@
     } else if (target_tile && action_get_target_kind(act) == ATK_TILE) {
       probabilities[act] = action_prob_vs_tile(actor_unit, act,
                                                target_tile);
-    } else if (action_get_target_kind(act) == ATK_SELF) {
+    } else if (is_same_tile && action_get_target_kind(act) == ATK_SELF) {
+      /* Don't bother with self targeted actions unless the actor is asking
+       * about what can be done to its own tile. */
       probabilities[act] = action_prob_self(actor_unit, act);
     } else {
       probabilities[act] = ACTPROB_IMPOSSIBLE;


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

Reply via email to