Author: sveinung
Date: Sun Mar 26 16:36:28 2017
New Revision: 35161

URL: http://svn.gna.org/viewcvs/freeciv?rev=35161&view=rev
Log:
Check that target is at target tile.

Have handle_unit_get_actions() check that target unit and target city is
located at the target tile. Assuming this makes it safe to just check the
tile.

See hrm Feature #647175

Modified:
    branches/S3_0/server/unithand.c

Modified: branches/S3_0/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/unithand.c?rev=35161&r1=35160&r2=35161&view=diff
==============================================================================
--- branches/S3_0/server/unithand.c     (original)
+++ branches/S3_0/server/unithand.c     Sun Mar 26 16:36:28 2017
@@ -1491,6 +1491,21 @@
     target_city = game_city_by_number(target_city_id_client);
   }
 
+  /* The specified target unit or target city must be located at the target
+   * tile. */
+  if ((target_city && city_tile(target_city) != target_tile)
+      || (target_unit && unit_tile(target_unit) != target_tile)) {
+    notify_player(actor_player, unit_tile(actor_unit),
+                  E_BAD_COMMAND, ftc_server,
+                  _("Target not at target tile."));
+    dsend_packet_unit_actions(pc, actor_unit_id,
+                              IDENTITY_NUMBER_ZERO, IDENTITY_NUMBER_ZERO,
+                              target_tile_id,
+                              disturb_player,
+                              probabilities);
+    return;
+  }
+
   /* Distance between actor and target tile. */
   actor_target_distance = real_map_distance(unit_tile(actor_unit),
                                             target_tile);


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

Reply via email to