Author: sveinung
Date: Fri Jun 17 01:58:01 2016
New Revision: 32876

URL: http://svn.gna.org/viewcvs/freeciv?rev=32876&view=rev
Log:
Unit order validate actions with 0 range.

Make the "Found City" action's check that the actor will target its own tile
apply to all actions with a max range of 0.

See patch #7264

Modified:
    trunk/server/unithand.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=32876&r1=32875&r2=32876&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Fri Jun 17 01:58:01 2016
@@ -4434,19 +4434,19 @@
         return;
       }
 
+      if (action_by_number(packet->action[i])->max_distance == 0
+          && map_untrusted_dir_is_valid(packet->dir[i])) {
+        /* Actor must be on the target tile. */
+        log_error("handle_unit_orders() can't do %s to a neighbor tile. "
+                  "Sent in order number %d from %s to unit number %d.",
+                  action_get_rule_name(packet->action[i]), i,
+                  player_name(pplayer), packet->unit_id);
+
+        return;
+      }
+
       /* Validate individual actions. */
       switch ((enum gen_action) packet->action[i]) {
-      case ACTION_FOUND_CITY:
-        if (map_untrusted_dir_is_valid(packet->dir[i])) {
-          /* Actor must be on the target tile. */
-          log_error("handle_unit_orders() can't do %s to a neighbor tile. "
-                    "Sent in order number %d from %s to unit number %d.",
-                    action_get_rule_name(packet->action[i]), i,
-                    player_name(pplayer), packet->unit_id);
-
-          return;
-        }
-        break;
       case ACTION_SPY_TARGETED_SABOTAGE_CITY:
         /* Sabotage target is production (-1) or a building. */
         if (!(packet->target[i] - 1 == -1
@@ -4488,6 +4488,7 @@
       case ACTION_SPY_BRIBE_UNIT:
       case ACTION_SPY_SABOTAGE_UNIT:
       case ACTION_CAPTURE_UNITS:
+      case ACTION_FOUND_CITY:
       case ACTION_JOIN_CITY:
       case ACTION_STEAL_MAPS:
       case ACTION_BOMBARD:


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

Reply via email to