Author: sveinung
Date: Wed Dec 23 15:59:19 2015
New Revision: 31165

clients: last move to an ally is an action move.

Some actions, like "Establish Trade Route", can often be done to targets
owned by the player him self or his allies. Some actions requires that the
actor unit has movement left. Moving to the last tile in a goto path can
cost enough movement to make an actor unit unable to perform an action it
would have been able to perform from the neighbor tile.

Make the last move in a plain goto try to pop up the action selection
dialog rather than moving to the last tile if it contains a domestic,
allied or team mate city, unit or unit stack. This can, in cases where the
action requires movement left, save a turn.

(This was the behavoir before move orders were split in action moves and
plain moves. Bug #24215 preserved the behavior until it was fixed)

See patch #6713


Modified: branches/S2_6/client/goto.c
--- branches/S2_6/client/goto.c (original)
+++ branches/S2_6/client/goto.c Wed Dec 23 15:59:19 2015
@@ -1399,7 +1399,24 @@
   if (p.orders[i - 1] == ORDER_MOVE
       && (is_non_allied_city_tile(old_tile, client_player()) != NULL
-          || is_non_allied_unit_tile(old_tile, client_player()) != NULL)) {
+          || is_non_allied_unit_tile(old_tile, client_player()) != NULL
+          || ((is_allied_city_tile(old_tile, client_player())
+               || is_allied_unit_tile(old_tile, client_player()))
+              && (can_utype_do_act_if_tgt_diplrel(unit_type_get(punit),
+                                                  ACTION_ANY,
+                                                  DRO_FOREIGN,
+                                                  FALSE)
+                  || can_utype_do_act_if_tgt_diplrel(unit_type_get(punit),
+                                                     ACTION_ANY,
+                                                     DS_ALLIANCE,
+                                                     TRUE)
+                  || can_utype_do_act_if_tgt_diplrel(unit_type_get(punit),
+                                                     ACTION_ANY,
+                                                     DS_TEAM,
+                                                     TRUE))))) {
+    /* Can't move to the target tile because of non allied unit/city or can
+     * move to the target tile but may be able to perform an action to an
+     * allied unit/city at the target tile. */
     p.orders[i - 1] = ORDER_ACTION_MOVE;

Freeciv-commits mailing list

Reply via email to