Author: sveinung
Date: Wed Mar 22 12:08:50 2017
New Revision: 35146

URL: http://svn.gna.org/viewcvs/freeciv?rev=35146&view=rev
Log:
Simplify "interpret move as action" handling.

Get the explanation why no action is possible when the client asks what
actions the unit can perform against the target tile.

See hrm Feature #645941

Modified:
    branches/S3_0/server/unithand.c

Modified: branches/S3_0/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/unithand.c?rev=35146&r1=35145&r2=35146&view=diff
==============================================================================
--- branches/S3_0/server/unithand.c     (original)
+++ branches/S3_0/server/unithand.c     Wed Mar 22 12:08:50 2017
@@ -3598,28 +3598,32 @@
        * it still looks like a target since move_do_not_act isn't set.
        * Assume that the intention is to do an action. */
 
-      if (action_tgt_unit(punit, pdesttile, can_not_move)
-          || action_tgt_city(punit, pdesttile, can_not_move)
-          || action_tgt_tile_units(punit, pdesttile, can_not_move)
-          || ttile) {
+      if ((action_tgt_unit(punit, pdesttile, can_not_move)
+           || action_tgt_city(punit, pdesttile, can_not_move)
+           || action_tgt_tile_units(punit, pdesttile, can_not_move)
+           || ttile)
+          || can_not_move) {
+        /* There is a target punit, from the player's point of view, may be
+         * able to act against OR punit can't do any non action move. The
+         * client should therefore ask what action(s) the unit can perform
+         * to any targets at pdesttile.
+         *
+         * In the first case the unit needs a decision about what action, if
+         * any at all, to take. Asking what actions the unit can perform
+         * will return a list of actions that may, from the players point of
+         * view, be possible. The client can then show this list to the
+         * player or, if configured to do so, make the choice it self.
+         *
+         * In the last case the player may need an explanation about why no
+         * action could be taken. Asking what actions the unit can perform
+         * will provide this explanation. */
         punit->action_decision_want = ACT_DEC_ACTIVE;
         punit->action_decision_tile = pdesttile;
-
-        /* Let the client know that this unit needs the player to decide
-         * what to do. */
         send_unit_info(player_reply_dest(pplayer), punit);
 
         /* The move wasn't done because the unit wanted the player to
-         * decide what to do. */
-        return FALSE;
-      } else if (can_not_move) {
-        /* No action can be done. No regular move can be done. Attack isn't
-         * possible. Try to explain it to the player. */
-        explain_why_no_action_enabled(punit, pdesttile, pcity,
-                                      is_non_attack_unit_tile(pdesttile,
-                                                              pplayer));
-
-        /* The move wasn't done because the unit couldn't do anything. */
+         * decide what to do or because the unit couldn't move to the
+         * target tile. */
         return FALSE;
       }
     }


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

Reply via email to