Author: sveinung
Date: Thu Jul 30 12:24:13 2015
New Revision: 29272

URL: http://svn.gna.org/viewcvs/freeciv?rev=29272&view=rev
Log:
Log errors caught by unit order validation

See patch #6151

Modified:
    branches/S2_6/server/unithand.c

Modified: branches/S2_6/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/unithand.c?rev=29272&r1=29271&r2=29272&view=diff
==============================================================================
--- branches/S2_6/server/unithand.c     (original)
+++ branches/S2_6/server/unithand.c     Thu Jul 30 12:24:13 2015
@@ -3096,6 +3096,11 @@
     case ORDER_MOVE:
     case ORDER_ACTION_MOVE:
       if (!is_valid_dir(packet->dir[i])) {
+        log_error("handle_unit_orders() %d isn't a valid move direction. "
+                  "Sent in order number %d from %s to unit number %d.",
+                  packet->dir[i], i,
+                  player_name(pplayer), packet->unit_id);
+
        return;
       }
       break;
@@ -3114,16 +3119,32 @@
       case ACTIVITY_SENTRY:
         if (i != length - 1) {
           /* Only allowed as the last order. */
+          log_error("handle_unit_orders() activity %d is only allowed in "
+                    "the last order. "
+                    "Sent in order number %d from %s to unit number %d.",
+                    packet->activity[i], i,
+                    player_name(pplayer), packet->unit_id);
+
           return;
         }
         break;
       case ACTIVITY_BASE:
         if (!is_extra_caused_by(extra_by_number(packet->target[i]), EC_BASE)) {
+          log_error("handle_unit_orders() %s isn't a base. "
+                    "Sent in order number %d from %s to unit number %d.",
+                    extra_rule_name(extra_by_number(packet->target[i])), i,
+                    player_name(pplayer), packet->unit_id);
+
           return;
         }
         break;
       case ACTIVITY_GEN_ROAD:
         if (!is_extra_caused_by(extra_by_number(packet->target[i]), EC_ROAD)) {
+          log_error("handle_unit_orders() %s isn't a road. "
+                    "Sent in order number %d from %s to unit number %d.",
+                    extra_rule_name(extra_by_number(packet->target[i])), i,
+                    player_name(pplayer), packet->unit_id);
+
           return;
         }
         break;
@@ -3142,6 +3163,11 @@
       case ACTIVITY_PATROL_UNUSED:
       case ACTIVITY_LAST:
       case ACTIVITY_UNKNOWN:
+        log_error("handle_unit_orders() unsupported activity %d. "
+                  "Sent in order number %d from %s to unit number %d.",
+                  packet->activity[i], i,
+                  player_name(pplayer), packet->unit_id);
+
         return;
       }
 
@@ -3149,6 +3175,11 @@
           && unit_activity_needs_target_from_client(packet->activity[i])) {
         /* The orders system can't do server side target assignment for
          * this activity. */
+        log_error("handle_unit_orders() can't assign target for %d. "
+                  "Sent in order number %d from %s to unit number %d.",
+                  packet->activity[i], i,
+                  player_name(pplayer), packet->unit_id);
+
         return;
       }
 


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

Reply via email to