Author: pepeto
Date: Sun Sep 14 11:21:32 2014
New Revision: 26397

URL: http://svn.gna.org/viewcvs/freeciv?rev=26397&view=rev
Log:
Fix that nuclears are able to nuke their current tile.

Reported by Jacob Nevins <jtn>

See gna bug #22610

Modified:
    branches/S2_4/client/control.c

Modified: branches/S2_4/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_4/client/control.c?rev=26397&r1=26396&r2=26397&view=diff
==============================================================================
--- branches/S2_4/client/control.c      (original)
+++ branches/S2_4/client/control.c      Sun Sep 14 11:21:32 2014
@@ -2509,6 +2509,7 @@
 
   if (is_valid_goto_draw_line(ptile)) {
     struct client_nuke_data *data = fc_malloc(sizeof(*data));
+    int last_request_id_used = client.conn.client.last_request_id_used;
     int i = 0;
 
     data->units_id = fc_malloc(sizeof(*data->units_id)
@@ -2520,9 +2521,19 @@
     data->tile_idx = tile_index(ptile);
 
     send_goto_route();
-    update_queue_connect_processing_finished_full
-        (client.conn.client.last_request_id_used,
-         do_real_unit_nuke, data, client_nuke_data_destroy);
+
+    if (last_request_id_used != client.conn.client.last_request_id_used) {
+      /* We sent some packets, let's wait the server to process them to know
+       * where our units hold. */
+      update_queue_connect_processing_finished_full
+          (client.conn.client.last_request_id_used,
+           do_real_unit_nuke, data, client_nuke_data_destroy);
+    } else {
+      /* We didn't sent the packets, that mean that the route was nil, or
+       * an internal error occured. Process nuke units now. */
+      do_real_unit_nuke(data);
+      client_nuke_data_destroy(data);
+    }
   } else {
     create_event(ptile, E_BAD_COMMAND, ftc_client,
                  _("Didn't find a route to the destination!"));


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

Reply via email to