Author: sveinung
Date: Thu Feb 26 15:12:58 2015
New Revision: 28322

URL: http://svn.gna.org/viewcvs/freeciv?rev=28322&view=rev
Log:
Don't allow a (buggy) client to set a unit's activity to ACTIVITY_GOTO.

Setting ACTIVITY_GOTO from the client results in a unit indicating it is
going somewhere while it is standing still. The appearance of the unit doing
something can trick the user to not make use of it.

See patch #5864

Modified:
    trunk/server/unithand.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=28322&r1=28321&r2=28322&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Thu Feb 26 15:12:58 2015
@@ -1484,6 +1484,17 @@
 
   punit->ai_controlled = FALSE;
   punit->goto_tile = NULL;
+
+  if (activity == ACTIVITY_GOTO) {
+    /* Don't permit a client to set a unit's activity to ACTIVITY_GOTO.
+     * Setting ACTIVITY_GOTO from the client results in a unit indicating
+     * it is going somewhere while it is standing still. The appearance of
+     * the unit doing something can trick the user to not make use of it.
+     *
+     * Handled here because adv_follow_path() uses unit_activity_handling()
+     * to set a unit's activity to ACTIVITY_GOTO. */
+    return;
+  }
 
   if (activity == ACTIVITY_EXPLORE) {
     unit_activity_handling_targeted(punit, activity, &activity_target);
@@ -2945,9 +2956,9 @@
       case ACTIVITY_FORTIFYING:
       case ACTIVITY_CONVERT:
       case ACTIVITY_EXPLORE:
+      case ACTIVITY_IDLE:
+      /* Not set from the client. */
       case ACTIVITY_GOTO:
-      case ACTIVITY_IDLE:
-      /* Allowing this to be set from the client would be cheating. */
       case ACTIVITY_FORTIFIED:
       /* Compatiblity, used in savegames. */
       case ACTIVITY_OLD_ROAD:


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

Reply via email to