Index: client/climisc.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v retrieving revision 1.97 diff -u -r1.97 climisc.c --- client/climisc.c 2002/05/25 17:44:06 1.97 +++ client/climisc.c 2002/06/10 09:31:02 @@ -301,6 +301,7 @@ bool fr_is_unit = cid_is_unit(x), to_is_unit = cid_is_unit(y); struct packet_city_request packet; char buf[512]; + int last_request_id = 0; my_snprintf(buf, sizeof(buf), _("Game: Changing production of every %s into %s."), @@ -310,6 +311,7 @@ name : get_improvement_name(to_id)); append_output_window(buf); + connection_do_buffer(&aconnection); city_list_iterate (game.player_ptr->cities, pcity) { if (((fr_is_unit && (pcity->is_building_unit) && @@ -325,11 +327,13 @@ packet.city_id = pcity->id; packet.build_id = to_id; packet.is_build_id_unit_id = to_is_unit; - send_packet_city_request (&aconnection, &packet, - PACKET_CITY_CHANGE); + last_request_id = send_packet_city_request(&aconnection, &packet, + PACKET_CITY_CHANGE); } - } - city_list_iterate_end; + } city_list_iterate_end; + + connection_do_unbuffer(&aconnection); + disable_cityrep_update_till(last_request_id); } /*************************************************************************** Index: client/packhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v retrieving revision 1.239 diff -u -r1.239 packhand.c --- client/packhand.c 2002/06/08 11:31:09 1.239 +++ client/packhand.c 2002/06/10 09:31:04 @@ -70,6 +70,7 @@ static void handle_city_packet_common(struct city *pcity, bool is_new, bool popup, bool investigate); +static int last_request_id_for_city_report = 0; #define TEST_ATTRIBUTES 0 @@ -2345,6 +2346,14 @@ aconnection.client.request_id_of_currently_handled_packet = 0; agents_processing_finished(); + + if (last_request_id_for_city_report != 0 + && last_request_id_for_city_report == + aconnection.client.last_processed_request_id_seen) { + report_update_delay_off(); + city_report_dialog_update(); + last_request_id_for_city_report = 0; + } } /************************************************************************** @@ -2370,4 +2379,16 @@ packet_type, size, request_id); assert(request_id); +} + +/************************************************************************** + Disable the updating the city report dialog till the answer + (PACKET_PROCESSING_FINISHED) of the given request is received. +**************************************************************************/ +void disable_cityrep_update_till(int request_id) +{ + if (request_id != 0) { + report_update_delay_on(); + last_request_id_for_city_report = request_id; + } } Index: client/packhand.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/packhand.h,v retrieving revision 1.25 diff -u -r1.25 packhand.h --- client/packhand.h 2002/03/21 20:35:24 1.25 +++ client/packhand.h 2002/06/10 09:31:04 @@ -68,4 +68,5 @@ void notify_about_outgoing_packet(struct connection *pc, int packet_type, int size, int request_id); +void disable_cityrep_update_till(int request_id); #endif /* FC__PACKHAND_H */ Index: client/agents/cma_core.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/agents/cma_core.c,v retrieving revision 1.24 diff -u -r1.24 cma_core.c --- client/agents/cma_core.c 2002/06/09 15:10:11 1.24 +++ client/agents/cma_core.c 2002/06/10 09:31:05 @@ -710,6 +710,7 @@ &packet); stats.refresh_forced++; } + disable_cityrep_update_till(last_request_id); connection_do_unbuffer(&aconnection); Index: client/gui-gtk/cityrep.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/cityrep.c,v retrieving revision 1.58 diff -u -r1.58 cityrep.c --- client/gui-gtk/cityrep.c 2002/04/09 15:16:20 1.58 +++ client/gui-gtk/cityrep.c 2002/06/10 09:31:06 @@ -39,6 +39,7 @@ #include "gui_main.h" #include "gui_stuff.h" #include "mapview.h" +#include "packhand.h" #include "optiondlg.h" #include "options.h" #include "repodlgs.h" @@ -261,20 +262,24 @@ else { bool is_unit = cid_is_unit(cid); - int id = cid_id(cid); + int last_request_id = 0, id = cid_id(cid); GList* selection = GTK_CLIST(city_list)->selection; g_assert(selection); - - for(; selection; selection = g_list_next(selection)) - { - struct packet_city_request packet; - packet.city_id=city_from_glist(selection)->id; - packet.build_id=id; - packet.is_build_id_unit_id=is_unit; - send_packet_city_request(&aconnection, &packet, PACKET_CITY_CHANGE); - } + connection_do_buffer(&aconnection); + for (; selection; selection = g_list_next(selection)) { + struct packet_city_request packet; + + packet.city_id = city_from_glist(selection)->id; + packet.build_id = id; + packet.is_build_id_unit_id = is_unit; + last_request_id = send_packet_city_request(&aconnection, &packet, + PACKET_CITY_CHANGE); + } + + connection_do_unbuffer(&aconnection); + disable_cityrep_update_till(last_request_id); } } Index: client/gui-gtk-2.0/cityrep.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/cityrep.c,v retrieving revision 1.16 diff -u -r1.16 cityrep.c --- client/gui-gtk-2.0/cityrep.c 2002/06/09 23:20:09 1.16 +++ client/gui-gtk-2.0/cityrep.c 2002/06/10 09:31:09 @@ -294,8 +294,10 @@ packet.build_id = id; packet.is_build_id_unit_id = is_unit; + connection_do_buffer(&aconnection); gtk_tree_selection_selected_foreach(city_selection, impr_or_unit_iterate, &packet); + connection_do_unbuffer(&aconnection); } } Index: client/gui-win32/cityrep.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/cityrep.c,v retrieving revision 1.10 diff -u -r1.10 cityrep.c --- client/gui-win32/cityrep.c 2002/05/08 10:30:19 1.10 +++ client/gui-win32/cityrep.c 2002/06/10 09:31:09 @@ -502,8 +502,7 @@ static void cityrep_change_menu(HWND hWnd, cid cid) { int cityids[256]; - int selcount; - int i; + int selcount, i, last_request_id = 0; struct city *pcity; bool is_unit = cid_is_unit(cid); int number = cid_id(cid); @@ -513,18 +512,23 @@ selcount=MIN(256,selcount); selcount=ListBox_GetSelItems(GetDlgItem(hWnd,ID_CITYREP_LIST), selcount,&cityids[0]); - for (i=0;iid; - packet.build_id=number; - packet.is_build_id_unit_id=is_unit; - send_packet_city_request(&aconnection, &packet, PACKET_CITY_CHANGE); - ListBox_SetSel(GetDlgItem(hWnd,ID_CITYREP_LIST),FALSE,cityids[i]); - } + + connection_do_buffer(&aconnection); + for (i = 0; i < selcount; i++) { + struct packet_city_request packet; + pcity = (struct city *) ListBox_GetItemData(GetDlgItem(hWnd, + ID_CITYREP_LIST), + cityids[i]); + packet.city_id = pcity->id; + packet.build_id = number; + packet.is_build_id_unit_id = is_unit; + last_request_id = + send_packet_city_request(&aconnection, &packet, PACKET_CITY_CHANGE); + ListBox_SetSel(GetDlgItem(hWnd, ID_CITYREP_LIST), FALSE, cityids[i]); + } + + connection_do_unbuffer(&aconnection); + disable_cityrep_update_till(last_request_id); } /**************************************************************************