Author: sveinung
Date: Thu Jul 30 12:23:35 2015
New Revision: 29270

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

See patch #6151

Modified:
    trunk/server/unithand.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=29270&r1=29269&r2=29270&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Thu Jul 30 12:23:35 2015
@@ -3442,6 +3442,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;
@@ -3460,16 +3465,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;
@@ -3488,6 +3509,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;
       }
 
@@ -3495,6 +3521,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