Author: sveinung
Date: Fri Feb  3 14:55:56 2017
New Revision: 34945

URL: http://svn.gna.org/viewcvs/freeciv?rev=34945&view=rev
Log:
Fix automatic attack for "Conquer City".

The "Conquer City" action is an attack action. It is city targeted.

A potentially legal attack action should pop up the action selection dialog
if the popup_attack_actions client option is set or if another interesting
action is possible. If the "Pop up attack questions" is unset and no other
interesting action is possible the client should order the conquest without
asking the user.

Make the client able to order city targeted actions (like "Conquer City")
without asking the user.

Reported by wotan <wotan>
Debugged by Christian Knoke <chrisk>

See bug #25336

Modified:
    trunk/client/packhand.c

Modified: trunk/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=34945&r1=34944&r2=34945&view=diff
==============================================================================
--- trunk/client/packhand.c     (original)
+++ trunk/client/packhand.c     Fri Feb  3 14:55:56 2017
@@ -4593,12 +4593,36 @@
       /* No interesting actions except a single attack action has been
        * found. The player wants it performed without questions. */
 
+      /* The order requests below doesn't send additional details. */
+      fc_assert(!action_requires_details(auto_action));
+
       /* Give the order. */
-      fc_assert(action_id_get_target_kind(auto_action) == ATK_TILE
-                || action_id_get_target_kind(auto_action) == ATK_UNITS);
-      request_do_action(auto_action,
-                        packet->actor_unit_id, packet->target_tile_id,
-                        0, "");
+      switch(action_id_get_target_kind(auto_action)) {
+      case ATK_TILE:
+      case ATK_UNITS:
+        request_do_action(auto_action,
+                          packet->actor_unit_id, packet->target_tile_id,
+                          0, "");
+        break;
+      case ATK_CITY:
+        request_do_action(auto_action,
+                          packet->actor_unit_id, packet->target_city_id,
+                          0, "");
+        break;
+      case ATK_UNIT:
+        request_do_action(auto_action,
+                          packet->actor_unit_id, packet->target_unit_id,
+                          0, "");
+        break;
+      case ATK_SELF:
+        request_do_action(auto_action,
+                          packet->actor_unit_id, packet->actor_unit_id,
+                          0, "");
+        break;
+      case ATK_COUNT:
+        fc_assert(action_id_get_target_kind(auto_action) != ATK_COUNT);
+        break;
+      }
 
       /* Clean up. */
       action_selection_no_longer_in_progress(packet->actor_unit_id);


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

Reply via email to