Author: sveinung
Date: Fri Feb  3 14:56:27 2017
New Revision: 34947

URL: http://svn.gna.org/viewcvs/freeciv?rev=34947&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:
    branches/S3_0/client/packhand.c

Modified: branches/S3_0/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/packhand.c?rev=34947&r1=34946&r2=34947&view=diff
==============================================================================
--- branches/S3_0/client/packhand.c     (original)
+++ branches/S3_0/client/packhand.c     Fri Feb  3 14:56:27 2017
@@ -4592,12 +4592,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