Author: sveinung
Date: Thu Jan 15 02:26:02 2015
New Revision: 27688

URL: http://svn.gna.org/viewcvs/freeciv?rev=27688&view=rev
Log:
explain_why_no_action_enabled(): Detect failure caused by being transported.

See patch #5709

Modified:
    trunk/server/unithand.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=27688&r1=27687&r2=27688&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Thu Jan 15 02:26:02 2015
@@ -442,17 +442,29 @@
 {
   struct player *pplayer = unit_owner(punit);
 
-  if (can_unit_exist_at_tile(punit, unit_tile(punit))
-      || can_unit_act_when_ustate_is(unit_type(punit),
-                                     USP_TRANSP_DEP, TRUE)) {
-    notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
-                  _("No action possible."));
-  } else {
+  if (!can_unit_exist_at_tile(punit, unit_tile(punit))
+      && !can_unit_act_when_ustate_is(unit_type(punit),
+                                      USP_TRANSP_DEP, TRUE)) {
+    /* Explaination: bad terrain. */
+
     struct terrain *pterrain = tile_terrain(unit_tile(punit));
 
     notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
                   _("Unit cannot act from %s."),
                   terrain_name_translation(pterrain));
+  } else if (unit_transported(punit)
+             && !can_unit_act_when_ustate_is(unit_type(punit),
+                                             USP_TRANSPORTED, TRUE)) {
+    /* Explaination: being transported. */
+
+    notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
+                  _("This unit is being transported, and"
+                    " so cannot act."));
+  } else {
+    /* Explaination not detected. */
+
+    notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
+                  _("No action possible."));
   }
 }
 


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

Reply via email to