Complete.Org: Mailing Lists: Archives: freeciv-dev: May 1999:
[Freeciv-Dev] PATCH: bugfix, select multiple units at city report, code
Home

[Freeciv-Dev] PATCH: bugfix, select multiple units at city report, code

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] PATCH: bugfix, select multiple units at city report, code cleanup
From: Markus Linnala <maage@xxxxxxxxx>
Date: 21 May 1999 10:13:16 +0300
Reply-to: Markus Linnala <maage@xxxxxxxxx>

First the small bugfix. If you mark city removal when at size 1
and build settlers, you might get core dump.

pseudo code:

loop over cities, pcity marks the current city:
  handle pcity and sometimes even delete it
  handle pcity even more and sometimes dump core
end;

I removed white space at the end of the line. And indented
files as some parts were not indented as the rest. 

With this patch you can select arbiturary amount of cities and
issue buy and changes commands on them. Try pointing shift or
alt pressed.

Examples:
- select 1 city and issue command, works as before
- select 2 or more cities and issue buy, client tries to buy
  improvement or unit at all cities, you can easily use all your
  money
- select 2 or more cities and issue change, select one, client
  tries to change production to the one you selected, if you
  select building and city already has building, there is no
  change, if you have 10 cities with all buildings, 10 without
  supermarket and one brand new, you can select all, then press
  alt and mouse on brand new twice and select supermarket on a
  list
- select all cities and deselect one which is building wonder,
  select another city again, change to caravan
- game just sold your barracks', select all and change to
  barracks N+1, issue buy, you have barracks again
- you have lot of money, more than you can use, select all and
  buy, too bad you don't buy capitalization
- pollution is not your friend, select every city with pollution
  and change them to build recycling

Another part of the patch adds same idea to the trade dialog.
Select all buildings and push 'Sell obsolete'. You get lot of
popups with confusing messages, but don't be alarmed. You just
sold all possible obsolete buildings. You can also easily sell
all buildings. Beware.

Comments:
User interface is not the best one. But this patch sure helps to
manage lot cities and lessens micromanagement. I hope you'll
include it to the main distribution. No Xaw version, sorry.

Patch is agains latest cvs-version.

------------------------------------------------------------------------        
1999-05-21  Markus Linnala  <maage@xxxxxxxxx>

        * server/cityturn.c
        (update_city_activity): 
        - Notice when city is deleted, and don't continue. Cores
          later if we continue.
        (city_build_stuff): 
        - Return 1 if we delete city otherwise 0.

        * client/gui-gtk/cityrep.c
        - remove empty space and ident according to freeciv -style

        (create_trade_report_dialog): 
        - set selection mode as EXTENDED
        - widen some

        (city_list_ucallback): 
        - only unset if there is not selected rows

        (city_change_callback): 
        - loop over selected items, and try to do the action on
          items one at time

        (city_buy_callback): same as above

        * client/gui-gtk/repodlgs.c 
        (trade_selloff_callback): 
        - loop over selected improvements

        * client/gui-gtk/repodlgs.h: 
        - change guardian definition -> FC__
        - add couple of void:s to satisfy gcc
------------------------------------------------------------------------        

diff --unified --recursive --new-file --exclude-from=.diffignore 
freeciv-cvs/client/gui-gtk/cityrep.c freeciv/client/gui-gtk/cityrep.c
--- freeciv-cvs/client/gui-gtk/cityrep.c        Fri May 21 08:48:31 1999
+++ freeciv/client/gui-gtk/cityrep.c    Fri May 21 09:43:34 1999
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@
 extern int delay_report_update;
 
 /* abbreviate long city names to this length in the city report: */
-#define REPORT_CITYNAME_ABBREV 15 
+#define REPORT_CITYNAME_ABBREV 15
 
 /************************************************************************
  cr_entry = return an entry (one column for one city) for the city report
@@ -74,7 +74,7 @@
 {
   static char buf[4];
   sprintf(buf, "%s", (city_celebrating(pcity) ? "*" :
-                    (city_unhappy(pcity) ? "X" : " ")));
+                     (city_unhappy(pcity) ? "X" : " ")));
   return buf;
 }
 
@@ -82,7 +82,7 @@
 {
   static char buf[16];
   sprintf(buf, "%s", (city_celebrating(pcity) ? "Rapture" :
-                    (city_unhappy(pcity) ? "Disorder" : "Peace")));
+                     (city_unhappy(pcity) ? "Disorder" : "Peace")));
   return buf;
 }
 
@@ -90,9 +90,9 @@
 {
   static char buf[32];
   sprintf(buf, "%d/%d/%d",
-        pcity->ppl_happy[4],
-        pcity->ppl_content[4],
-        pcity->ppl_unhappy[4]);
+         pcity->ppl_happy[4],
+         pcity->ppl_content[4],
+         pcity->ppl_unhappy[4]);
   return buf;
 }
 
@@ -100,7 +100,7 @@
 {
   static char buf[32];
   sprintf(buf, "%d/%d/%d",
-        pcity->ppl_elvis,
+         pcity->ppl_elvis,
          pcity->ppl_scientist,
          pcity->ppl_taxman);
   return buf;
@@ -110,9 +110,9 @@
 {
   static char buf[32];
   sprintf(buf, "%d/%d/%d",
-        pcity->food_surplus, 
-        pcity->shield_surplus, 
-        pcity->trade_prod);
+         pcity->food_surplus,
+         pcity->shield_surplus,
+         pcity->trade_prod);
   return buf;
 }
 
@@ -125,8 +125,8 @@
   sprintf(buf, "%s%d/%d/%d",
          (goldie < 0) ? "-" : (goldie > 0) ? "+" : "",
          (goldie < 0) ? (-goldie) : goldie,
-        pcity->luxury_total,
-        pcity->science_total);
+         pcity->luxury_total,
+         pcity->science_total);
   return buf;
 }
 
@@ -134,8 +134,8 @@
 {
   static char buf[32];
   sprintf(buf,"%d/%d",
-        pcity->food_stock,
-        pcity->size * game.foodbox);
+         pcity->food_stock,
+         pcity->size * game.foodbox);
   return buf;
 }
 
@@ -157,17 +157,17 @@
 {
   static char buf[64];
   if(pcity->is_building_unit)
-    sprintf(buf, "%s(%d/%d/%d)", 
+    sprintf(buf, "%s(%d/%d/%d)",
            get_unit_type(pcity->currently_building)->name,
-          pcity->shield_stock,
-          get_unit_type(pcity->currently_building)->build_cost,
-          city_buy_cost(pcity));
+           pcity->shield_stock,
+           get_unit_type(pcity->currently_building)->build_cost,
+           city_buy_cost(pcity));
   else
-    sprintf(buf, "%s(%d/%d/%d)", 
-          get_imp_name_ex(pcity, pcity->currently_building),
-          pcity->shield_stock,
-          get_improvement_type(pcity->currently_building)->build_cost,
-          city_buy_cost(pcity));
+    sprintf(buf, "%s(%d/%d/%d)",
+           get_imp_name_ex(pcity, pcity->currently_building),
+           pcity->shield_stock,
+           get_improvement_type(pcity->currently_building)->build_cost,
+           city_buy_cost(pcity));
   return buf;
 }
 
@@ -196,7 +196,7 @@
 };
 
 /* This generates the function name and the tagname: */
-#define FUNC_TAG(var)  cr_entry_##var, #var 
+#define FUNC_TAG(var)  cr_entry_##var, #var
 
 /* Use tagname rather than index for load/save, because later
    additions won't necessarily be at the end.
@@ -210,37 +210,37 @@
 
 static struct city_report_spec city_report_specs[] = {
   { 1,-15, 0, "",  "Name",           "City Name",
-                                     FUNC_TAG(cityname) },
+    FUNC_TAG(cityname) },
   { 0, -2, 1, "",  "Sz",             "Size",
-                                     FUNC_TAG(size) },
+    FUNC_TAG(size) },
   { 1, -8, 1, "",  "State",          "Rapture/Peace/Disorder",
-                                     FUNC_TAG(hstate_verbose) },
+    FUNC_TAG(hstate_verbose) },
   { 0, -1, 1, "",  "",               "Concise *=Rapture, X=Disorder",
-                                     FUNC_TAG(hstate_concise) },
+    FUNC_TAG(hstate_concise) },
   { 1, -8, 1, "Workers", "H/C/U",     "Workers: Happy, Content, Unhappy",
-                                     FUNC_TAG(workers) },
+    FUNC_TAG(workers) },
   { 0, -7, 1, "Special", "E/S/T",     "Entertainers, Scientists, Taxmen",
-                                     FUNC_TAG(specialists) },
+    FUNC_TAG(specialists) },
   { 1,-10, 1, "Surplus", "F/P/T",     "Surplus: Food, Production, Trade",
-                                     FUNC_TAG(resources) },
+    FUNC_TAG(resources) },
   { 1,-10, 1, "Economy", "G/L/S",     "Economy: Gold, Luxuries, Science",
-                                     FUNC_TAG(output) },
+    FUNC_TAG(output) },
   { 0, -1, 1, "n", "T",              "Number of Trade Routes",
-                                     FUNC_TAG(num_trade) },
+    FUNC_TAG(num_trade) },
   { 1, -7, 1, "Food", "Stock",        "Food Stock",
-                                     FUNC_TAG(food) },
+    FUNC_TAG(food) },
   { 0, -3, 1, "", "Pol",             "Pollution",
-                                     FUNC_TAG(pollution) },
+    FUNC_TAG(pollution) },
   { 0, -3, 1, "", "Cor",              "Corruption",
-                                      FUNC_TAG(corruption) },
+    FUNC_TAG(corruption) },
   { 1,  0, 1, "Currently Building",   "(Stock,Target,Buy Cost)",
-                                     "Currently Building",
-                                     FUNC_TAG(building) }
+    "Currently Building",
+    FUNC_TAG(building) }
 };
 
 #define NUM_CREPORT_COLS \
         sizeof(city_report_specs)/sizeof(city_report_specs[0])
-     
+
 /******************************************************************
 Some simple wrappers:
 ******************************************************************/
@@ -283,7 +283,7 @@
 GtkWidget *city_label;
 GtkWidget *city_list;
 GtkWidget *city_center_command, *city_popup_command, *city_buy_command,
-         *city_refresh_command, *city_config_command;
+  *city_refresh_command, *city_config_command;
 GtkWidget *city_change_command, *city_popupmenu;
 
 int city_dialog_shell_is_modal;
@@ -322,7 +322,7 @@
 /****************************************************************
 
                       CITY REPORT DIALOG
- 
+
 ****************************************************************/
 
 /****************************************************************
@@ -331,16 +331,16 @@
 void popup_city_report_dialog(int make_modal)
 {
   if(!city_dialog_shell) {
-      city_dialog_shell_is_modal=make_modal;
-    
-      if(make_modal)
-       gtk_widget_set_sensitive(toplevel, FALSE);
-      
-      create_city_report_dialog(make_modal);
-      gtk_set_relative_position(toplevel, city_dialog_shell, 10, 10);
+    city_dialog_shell_is_modal=make_modal;
+
+    if(make_modal)
+      gtk_widget_set_sensitive(toplevel, FALSE);
+
+    create_city_report_dialog(make_modal);
+    gtk_set_relative_position(toplevel, city_dialog_shell, 10, 10);
 
-      gtk_widget_show(city_dialog_shell);
-   }
+    gtk_widget_show(city_dialog_shell);
+  }
 }
 
 
@@ -350,12 +350,12 @@
 static gint city_change_mbutton_callback(GtkWidget *w, GdkEvent *event)
 {
   GdkEventButton *bevent = (GdkEventButton *)event;
-  
+
   if ( event->type != GDK_BUTTON_PRESS )
     return FALSE;
 
   gtk_menu_popup(GTK_MENU(city_popupmenu),
-       NULL,NULL,NULL,NULL,bevent->button,bevent->time);
+                NULL,NULL,NULL,NULL,bevent->button,bevent->time);
 
   return TRUE;
 }
@@ -372,10 +372,10 @@
   char      *report_title;
   int        i;
   GtkAccelGroup *accel=gtk_accel_group_new();
-  
+
   city_dialog_shell = gtk_dialog_new();
   gtk_signal_connect( GTK_OBJECT(city_dialog_shell),"delete_event",
-        GTK_SIGNAL_FUNC(city_close_callback),NULL );
+                     GTK_SIGNAL_FUNC(city_close_callback),NULL );
   gtk_accel_group_attach(accel, GTK_OBJECT(city_dialog_shell));
 
   gtk_window_set_title(GTK_WINDOW(city_dialog_shell),"City Report");
@@ -385,7 +385,7 @@
   free(report_title);
 
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(city_dialog_shell)->vbox ),
-        city_label, FALSE, FALSE, 0 );
+                     city_label, FALSE, FALSE, 0 );
 
   for (i=0;i<NUM_CREPORT_COLS;i++)
     titles[i]=buf[i];
@@ -395,78 +395,79 @@
   city_list = gtk_clist_new_with_titles(NUM_CREPORT_COLS,titles);
   gtk_clist_column_titles_passive(GTK_CLIST(city_list));
   gtk_clist_set_auto_sort (GTK_CLIST (city_list), TRUE);
+  gtk_clist_set_selection_mode(GTK_CLIST (city_list), GTK_SELECTION_EXTENDED);
   scrolled = gtk_scrolled_window_new(NULL, NULL);
   gtk_container_add(GTK_CONTAINER(scrolled), city_list);
   gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled ),
-                         GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
-  gtk_widget_set_usize(city_list, 620, 150);
+                                 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+  gtk_widget_set_usize(city_list, 640, 150);
 
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(city_dialog_shell)->vbox ),
-        scrolled, TRUE, TRUE, 0 );
+                     scrolled, TRUE, TRUE, 0 );
 
   close_command                = gtk_accelbutton_new("C_lose", accel);
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(city_dialog_shell)->action_area ),
-        close_command, TRUE, TRUE, 0 );
+                     close_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( close_command, GTK_CAN_DEFAULT );
   gtk_widget_grab_default( close_command );
 
   city_center_command  = gtk_accelbutton_new("Cen_ter", accel);
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(city_dialog_shell)->action_area ),
-        city_center_command, TRUE, TRUE, 0 );
+                     city_center_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( city_center_command, GTK_CAN_DEFAULT );
 
   city_popup_command   = gtk_accelbutton_new("_Popup", accel);
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(city_dialog_shell)->action_area ),
-        city_popup_command, TRUE, TRUE, 0 );
+                     city_popup_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( city_popup_command, GTK_CAN_DEFAULT );
 
   city_buy_command     = gtk_accelbutton_new("_Buy", accel);
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(city_dialog_shell)->action_area ),
-        city_buy_command, TRUE, TRUE, 0 );
+                     city_buy_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( city_buy_command, GTK_CAN_DEFAULT );
 
   city_change_command  = gtk_accelbutton_new("_Change", accel);
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(city_dialog_shell)->action_area ),
-        city_change_command, TRUE, TRUE, 0 );
+                     city_change_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( city_change_command, GTK_CAN_DEFAULT );
 
   city_popupmenu=gtk_menu_new();
 
   gtk_signal_connect( GTK_OBJECT( city_change_command ), "event",
-       GTK_SIGNAL_FUNC( city_change_mbutton_callback ), NULL );
+                     GTK_SIGNAL_FUNC( city_change_mbutton_callback ), NULL );
 
   city_refresh_command = gtk_accelbutton_new("_Refresh", accel);
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(city_dialog_shell)->action_area ),
-        city_refresh_command, TRUE, TRUE, 0 );
+                     city_refresh_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( city_refresh_command, GTK_CAN_DEFAULT );
-  
+
   city_config_command  = gtk_accelbutton_new("Con_figure", accel);
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(city_dialog_shell)->action_area ),
-        city_config_command, TRUE, TRUE, 0 );
+                     city_config_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( city_config_command, GTK_CAN_DEFAULT );
 
   gtk_signal_connect(GTK_OBJECT(close_command), "clicked",
-       GTK_SIGNAL_FUNC(city_close_callback), NULL);
+                    GTK_SIGNAL_FUNC(city_close_callback), NULL);
   gtk_signal_connect(GTK_OBJECT(city_center_command), "clicked",
-       GTK_SIGNAL_FUNC(city_center_callback), NULL);
+                    GTK_SIGNAL_FUNC(city_center_callback), NULL);
   gtk_signal_connect(GTK_OBJECT(city_popup_command), "clicked",
-       GTK_SIGNAL_FUNC(city_popup_callback), NULL);
+                    GTK_SIGNAL_FUNC(city_popup_callback), NULL);
   gtk_signal_connect(GTK_OBJECT(city_buy_command), "clicked",
-       GTK_SIGNAL_FUNC(city_buy_callback), NULL);
+                    GTK_SIGNAL_FUNC(city_buy_callback), NULL);
   gtk_signal_connect(GTK_OBJECT(city_refresh_command), "clicked",
-       GTK_SIGNAL_FUNC(city_refresh_callback), NULL);
+                    GTK_SIGNAL_FUNC(city_refresh_callback), NULL);
   gtk_signal_connect(GTK_OBJECT(city_config_command), "clicked",
-       GTK_SIGNAL_FUNC(city_config_callback), NULL);
+                    GTK_SIGNAL_FUNC(city_config_callback), NULL);
   gtk_signal_connect(GTK_OBJECT(city_list), "select_row",
-       GTK_SIGNAL_FUNC(city_list_callback), NULL);
+                    GTK_SIGNAL_FUNC(city_list_callback), NULL);
   gtk_signal_connect(GTK_OBJECT(city_list), "unselect_row",
-       GTK_SIGNAL_FUNC(city_list_ucallback), NULL);
+                    GTK_SIGNAL_FUNC(city_list_ucallback), NULL);
 
   gtk_widget_show_all( GTK_DIALOG(city_dialog_shell)->vbox );
   gtk_widget_show_all( GTK_DIALOG(city_dialog_shell)->action_area );
 
   gtk_widget_add_accelerator(close_command, "clicked",
-       accel, GDK_Escape, 0, 0);
+                            accel, GDK_Escape, 0, 0);
 
   city_report_dialog_update();
 }
@@ -496,7 +497,7 @@
     flag = 0;
 
     for(i=0; i<B_LAST; i++)
-      if(can_build_improvement(pcity, i)) 
+      if(can_build_improvement(pcity, i))
       {
         GtkWidget *item;
 
@@ -505,8 +506,8 @@
         gtk_menu_append(GTK_MENU(city_popupmenu),item);
 
         gtk_signal_connect(GTK_OBJECT(item),"activate",
-            GTK_SIGNAL_FUNC(city_change_callback),
-            (gpointer)i);
+                          GTK_SIGNAL_FUNC(city_change_callback),
+                          (gpointer)i);
         flag=1;
       }
 
@@ -514,14 +515,14 @@
       if(can_build_unit(pcity, i)) {
         GtkWidget *item;
 
-        sprintf(buf,"%s (%d)", 
+        sprintf(buf,"%s (%d)",
                 get_unit_name(i),get_unit_type(i)->build_cost);
         item=gtk_menu_item_new_with_label( buf );
         gtk_menu_append(GTK_MENU(city_popupmenu),item);
 
         gtk_signal_connect(GTK_OBJECT(item),"activate",
-            GTK_SIGNAL_FUNC(city_change_callback),
-            (gpointer)(i+B_LAST));
+                          GTK_SIGNAL_FUNC(city_change_callback),
+                          (gpointer)(i+B_LAST));
         flag = 1;
       }
 
@@ -541,10 +542,13 @@
 
 void city_list_ucallback(GtkWidget *w, gint row, gint column)
 {
-      gtk_widget_set_sensitive(city_change_command, FALSE);
-      gtk_widget_set_sensitive(city_center_command, FALSE);
-      gtk_widget_set_sensitive(city_popup_command, FALSE);
-      gtk_widget_set_sensitive(city_buy_command, FALSE);
+  if (!GTK_CLIST( city_list )->selection)
+  {
+    gtk_widget_set_sensitive(city_change_command, FALSE);
+    gtk_widget_set_sensitive(city_center_command, FALSE);
+    gtk_widget_set_sensitive(city_popup_command, FALSE);
+    gtk_widget_set_sensitive(city_buy_command, FALSE);
+  }
 }
 
 /****************************************************************
@@ -583,24 +587,23 @@
   gint                row;
   struct city *pcity;
 
-  if ( !( selection = GTK_CLIST( city_list )->selection ) )
-      return;
-
-  row = (gint)selection->data;
-
-  if((pcity=gtk_clist_get_row_data(GTK_CLIST(city_list),row)))
+  while((selection = GTK_CLIST(city_list)->selection) != NULL)
   {
+    row = (gint)selection->data;
+
+    if((pcity=gtk_clist_get_row_data(GTK_CLIST(city_list),row)))
+    {
       struct packet_city_request packet;
       int build_nr;
       int unit;
-      
+
       build_nr = (size_t) data;
 
       if (build_nr >= B_LAST)
-       {
-         build_nr -= B_LAST;
-         unit = 1;
-       }
+      {
+       build_nr -= B_LAST;
+       unit = 1;
+      }
       else
        unit = 0;
 
@@ -609,6 +612,9 @@
       packet.build_id=build_nr;
       packet.is_build_id_unit_id=unit;
       send_packet_city_request(&aconnection, &packet, PACKET_CITY_CHANGE);
+
+    }
+    gtk_clist_unselect_row(GTK_CLIST(city_list),row,0);
   }
 }
 
@@ -621,36 +627,37 @@
   gint                row;
   struct city *pcity;
 
-  if ( !( selection = GTK_CLIST( city_list )->selection ) )
-      return;
-
-  row = (gint)selection->data;
-
-  if((pcity=gtk_clist_get_row_data(GTK_CLIST(city_list),row)))
+  while ((selection = GTK_CLIST(city_list)->selection) != NULL)
   {
+    row = (gint)selection->data;
+
+    if((pcity=gtk_clist_get_row_data(GTK_CLIST(city_list),row)))
+    {
       int value;
       char *name;
       char buf[512];
 
-      value=city_buy_cost(pcity);    
+      value=city_buy_cost(pcity);
       if(pcity->is_building_unit)
        name=get_unit_type(pcity->currently_building)->name;
       else
        name=get_imp_name_ex(pcity, pcity->currently_building);
 
       if (game.player_ptr->economic.gold >= value)
-       {
-         struct packet_city_request packet;
-         packet.city_id=pcity->id;
-         packet.name[0]='\0';
-         send_packet_city_request(&aconnection, &packet, PACKET_CITY_BUY);
-       }
+      {
+       struct packet_city_request packet;
+       packet.city_id=pcity->id;
+       packet.name[0]='\0';
+       send_packet_city_request(&aconnection, &packet, PACKET_CITY_BUY);
+      }
       else
-       {
-         sprintf(buf, "Game: %s costs %d gold and you only have %d gold.",
-                 name,value,game.player_ptr->economic.gold);
-         append_output_window(buf);
-       }
+      {
+       sprintf(buf, "Game: %s costs %d gold and you only have %d gold.",
+               name,value,game.player_ptr->economic.gold);
+       append_output_window(buf);
+      }
+    }
+    gtk_clist_unselect_row(GTK_CLIST(city_list),row,0);
   }
 }
 
@@ -661,9 +668,9 @@
 {
 
   if(city_dialog_shell_is_modal)
-     gtk_widget_set_sensitive(toplevel, TRUE);
-   gtk_widget_destroy(city_dialog_shell);
-   city_dialog_shell=NULL;
+    gtk_widget_set_sensitive(toplevel, TRUE);
+  gtk_widget_destroy(city_dialog_shell);
+  city_dialog_shell=NULL;
 }
 
 /****************************************************************
@@ -676,7 +683,7 @@
   struct city        *pcity;
 
   if ( !( selection = GTK_CLIST( city_list )->selection ) )
-      return;
+    return;
 
   row = (gint)selection->data;
 
@@ -693,14 +700,15 @@
   gint                row;
   struct city        *pcity;
 
-  if ( !( selection = GTK_CLIST( city_list )->selection ) )
-      return;
-
-  row = (gint)selection->data;
+  while((selection = GTK_CLIST(city_list)->selection) != NULL)
+  {
+    row = (gint)selection->data;
 
-  if((pcity=gtk_clist_get_row_data(GTK_CLIST(city_list),row))){
-    center_tile_mapcanvas(pcity->x, pcity->y);
-    popup_city_dialog(pcity, 0);
+    if((pcity=gtk_clist_get_row_data(GTK_CLIST(city_list),row))){
+      center_tile_mapcanvas(pcity->x, pcity->y);
+      popup_city_dialog(pcity, 0);
+    }
+    gtk_clist_unselect_row(GTK_CLIST(city_list),row,0);
   }
 }
 
@@ -724,18 +732,18 @@
     char *report_title;
     struct city_report_spec *spec;
 
-  if(delay_report_update) return;
-  if(!city_dialog_shell) return;
+    if(delay_report_update) return;
+    if(!city_dialog_shell) return;
 
     report_title=get_report_title("City Advisor");
     gtk_set_label(city_label, report_title);
     free(report_title);
 
     if (city_popupmenu)
-      {
-       gtk_widget_destroy(city_popupmenu);
-       city_popupmenu = 0;
-      }    
+    {
+      gtk_widget_destroy(city_popupmenu);
+      city_popupmenu = 0;
+    }
 
     for (i=0, spec=city_report_specs;i<NUM_CREPORT_COLS;i++, spec++)
     {
@@ -801,11 +809,11 @@
 /****************************************************************
 
                      CITY REPORT CONFIGURE DIALOG
- 
+
 ****************************************************************/
 
 /****************************************************************
-... 
+...
 *****************************************************************/
 void popup_city_report_config_dialog(void)
 {
@@ -813,12 +821,12 @@
 
   if(config_shell)
     return;
-  
+
   create_city_report_config_dialog();
 
   for(i=1; i<NUM_CREPORT_COLS; i++) {
     gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(config_toggle[i]),
-        city_report_specs[i].show);
+                               city_report_specs[i].show);
   }
 
   gtk_set_relative_position(toplevel, config_shell, 25, 25);
@@ -834,30 +842,30 @@
   GtkWidget *config_label, *config_ok_command;
   struct city_report_spec *spec;
   int i;
-  
+
   config_shell = gtk_dialog_new();
   gtk_window_set_title (GTK_WINDOW(config_shell), "Configure City Report");
   gtk_window_set_position (GTK_WINDOW(config_shell), GTK_WIN_POS_MOUSE);
 
   config_label = gtk_label_new("Set columns shown");
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(config_shell)->vbox), config_label,
-                       FALSE, FALSE, 0);
+                    FALSE, FALSE, 0);
 
   for(i=1, spec=city_report_specs+i; i<NUM_CREPORT_COLS; i++, spec++) {
     config_toggle[i]=gtk_check_button_new_with_label(spec->explanation);
 
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(config_shell)->vbox), 
config_toggle[i],
-                       FALSE, FALSE, 0);
+                      FALSE, FALSE, 0);
   }
 
   config_ok_command = gtk_button_new_with_label("Close");
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(config_shell)->action_area),
-                       config_ok_command, TRUE, TRUE, 0);
+                    config_ok_command, TRUE, TRUE, 0);
   GTK_WIDGET_SET_FLAGS(config_ok_command, GTK_CAN_DEFAULT );
   gtk_widget_grab_default(config_ok_command);
-  
+
   gtk_signal_connect(GTK_OBJECT(config_ok_command), "clicked",
-       GTK_SIGNAL_FUNC(config_ok_command_callback), NULL);
+                    GTK_SIGNAL_FUNC(config_ok_command_callback), NULL);
 
   gtk_widget_show_all( GTK_DIALOG(config_shell)->vbox );
   gtk_widget_show_all( GTK_DIALOG(config_shell)->action_area );
@@ -873,7 +881,7 @@
   struct city_report_spec *spec;
   gboolean b;
   int i;
-  
+
   for(i=1, spec=city_report_specs+i; i<NUM_CREPORT_COLS; i++, spec++) {
     b=GTK_TOGGLE_BUTTON(config_toggle[i])->active;
     spec->show = b;
diff --unified --recursive --new-file --exclude-from=.diffignore 
freeciv-cvs/client/gui-gtk/repodlgs.c freeciv/client/gui-gtk/repodlgs.c
--- freeciv-cvs/client/gui-gtk/repodlgs.c       Mon May 17 13:01:30 1999
+++ freeciv/client/gui-gtk/repodlgs.c   Fri May 21 09:43:34 1999
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -116,7 +116,7 @@
   if(delay_report_update) return;
   activeunits_report_dialog_update();
   trade_report_dialog_update();
-  city_report_dialog_update(); 
+  city_report_dialog_update();
   science_dialog_update();
 }
 
@@ -126,7 +126,7 @@
 char *get_report_title(char *report_name)
 {
   char buf[512];
-  
+
   sprintf(buf, "%s\n%s of the %s\n%s %s: %s",
          report_name,
          get_government_name(game.player_ptr->government),
@@ -146,10 +146,10 @@
 {
   if(!science_dialog_shell) {
     science_dialog_shell_is_modal=make_modal;
-    
+
     if(make_modal)
       gtk_widget_set_sensitive(toplevel, FALSE);
-    
+
     create_science_dialog(make_modal);
     gtk_set_relative_position(toplevel, science_dialog_shell, 10, 10);
 
@@ -170,7 +170,7 @@
 
   science_dialog_shell = gtk_dialog_new();
   gtk_signal_connect( GTK_OBJECT(science_dialog_shell),"delete_event",
-        GTK_SIGNAL_FUNC(science_close_callback),NULL );
+                     GTK_SIGNAL_FUNC(science_close_callback),NULL );
   gtk_accel_group_attach(accel, GTK_OBJECT(science_dialog_shell));
 
   gtk_window_set_title (GTK_WINDOW(science_dialog_shell), "Science Report");
@@ -181,11 +181,11 @@
   free(report_title);
 
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(science_dialog_shell)->vbox ),
-        science_label, FALSE, FALSE, 0 );
+                     science_label, FALSE, FALSE, 0 );
 
   frame = gtk_frame_new("Researching");
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(science_dialog_shell)->vbox ),
-        frame, FALSE, FALSE, 0 );
+                     frame, FALSE, FALSE, 0 );
 
   hbox = gtk_hbox_new( TRUE, 5 );
   gtk_container_add(GTK_CONTAINER(frame),hbox);
@@ -202,7 +202,7 @@
 
   frame = gtk_frame_new( "Goal");
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(science_dialog_shell)->vbox ),
-        frame, FALSE, FALSE, 0 );
+                     frame, FALSE, FALSE, 0 );
 
   hbox = gtk_hbox_new( TRUE, 5 );
   gtk_container_add(GTK_CONTAINER(frame),hbox);
@@ -224,28 +224,28 @@
   gtk_container_add(GTK_CONTAINER(scrolled), science_list);
 
   gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled ),
-                         GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+                                 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(science_dialog_shell)->vbox ),
-               scrolled, TRUE, TRUE, 0 );
+                     scrolled, TRUE, TRUE, 0 );
 
   close_command = gtk_button_new_with_label("Close");
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(science_dialog_shell)->action_area ),
-        close_command, TRUE, TRUE, 0 );
+                     close_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( close_command, GTK_CAN_DEFAULT );
   gtk_widget_grab_default( close_command );
 
   gtk_signal_connect( GTK_OBJECT( close_command ), "clicked",
-        GTK_SIGNAL_FUNC( science_close_callback ), NULL);
+                     GTK_SIGNAL_FUNC( science_close_callback ), NULL);
   /*
-  XtAddCallback(science_list, XtNcallback, science_help_callback, NULL);
-*/
+    XtAddCallback(science_list, XtNcallback, science_help_callback, NULL);
+  */
   gtk_widget_set_usize(science_label, 500,0);
-  
+
   gtk_widget_show_all( GTK_DIALOG(science_dialog_shell)->vbox );
   gtk_widget_show_all( GTK_DIALOG(science_dialog_shell)->action_area );
 
   gtk_widget_add_accelerator(close_command, "clicked",
-       accel, GDK_Escape, 0, GTK_ACCEL_VISIBLE);
+                            accel, GDK_Escape, 0, GTK_ACCEL_VISIBLE);
 
   science_dialog_update();
 }
@@ -265,15 +265,15 @@
   if (b == TRUE)
     select_help_item_string(advances[to].name);
   else
-    {  
-      sprintf(text, "%d/%d",
-             game.player_ptr->research.researched, 
-             research_time(game.player_ptr));
-      gtk_set_label(science_current_label,text);
-  
-      packet.tech=to;
-      send_packet_player_request(&aconnection, &packet, 
PACKET_PLAYER_RESEARCH);
-    }
+  {
+    sprintf(text, "%d/%d",
+           game.player_ptr->research.researched,
+           research_time(game.player_ptr));
+    gtk_set_label(science_current_label,text);
+
+    packet.tech=to;
+    send_packet_player_request(&aconnection, &packet, PACKET_PLAYER_RESEARCH);
+  }
 }
 
 /****************************************************************
@@ -289,9 +289,9 @@
   to=(size_t)data;
 
   if (b == TRUE)
-     select_help_item_string(advances[to].name);
+    select_help_item_string(advances[to].name);
   else
-  {  
+  {
     sprintf(text, "(%d steps)",
            tech_goal_turns(game.player_ptr, to));
     gtk_set_label(science_goal_label,text);
@@ -325,12 +325,12 @@
 
   XtVaGetValues(science_help_toggle, XtNstate, &b, NULL);
   if (b == TRUE)
-    {
-      if(ret->list_index!=XAW_LIST_NONE)
-        popup_help_dialog_typed(ret->string, HELP_TECH);
-      else
-        popup_help_dialog_string(HELP_TECHS_ITEM);
-    }
+  {
+    if(ret->list_index!=XAW_LIST_NONE)
+      popup_help_dialog_typed(ret->string, HELP_TECH);
+    else
+      popup_help_dialog_string(HELP_TECHS_ITEM);
+  }
 }
 #endif
 
@@ -340,111 +340,111 @@
 void science_dialog_update(void)
 {
   if(science_dialog_shell) {
-  char text[512];
+    char text[512];
     int i, j, hist;
     char *report_title;
     static char *row   [1];
     GtkWidget *item;
-    
-  if(delay_report_update) return;
-  report_title=get_report_title("Science Advisor");
-  gtk_set_label(science_label, report_title);
-  free(report_title);
 
-  gtk_clist_freeze(GTK_CLIST(science_list));
-  gtk_clist_clear(GTK_CLIST(science_list));
-  for(i=1; i<A_LAST; i++)
-  {
-    if ((get_invention(game.player_ptr, i)==TECH_KNOWN)){
-      row[0] = advances[i].name;
+    if(delay_report_update) return;
+    report_title=get_report_title("Science Advisor");
+    gtk_set_label(science_label, report_title);
+    free(report_title);
 
-      gtk_clist_append( GTK_CLIST(science_list), row);
+    gtk_clist_freeze(GTK_CLIST(science_list));
+    gtk_clist_clear(GTK_CLIST(science_list));
+    for(i=1; i<A_LAST; i++)
+    {
+      if ((get_invention(game.player_ptr, i)==TECH_KNOWN)){
+       row[0] = advances[i].name;
+
+       gtk_clist_append( GTK_CLIST(science_list), row);
       }
-  }
-  gtk_clist_thaw(GTK_CLIST(science_list));
+    }
+    gtk_clist_thaw(GTK_CLIST(science_list));
 
-  gtk_widget_destroy(popupmenu);
-  popupmenu = gtk_menu_new();
+    gtk_widget_destroy(popupmenu);
+    popupmenu = gtk_menu_new();
 
-  sprintf(text, "%d/%d",
-         game.player_ptr->research.researched, research_time(game.player_ptr));
-  gtk_set_label(science_current_label,text);
+    sprintf(text, "%d/%d",
+           game.player_ptr->research.researched, 
research_time(game.player_ptr));
+    gtk_set_label(science_current_label,text);
 
-  hist=0;
-  if (game.player_ptr->research.researching!=A_NONE)
-  {
-    for(i=1, j=0; i<A_LAST; i++)
+    hist=0;
+    if (game.player_ptr->research.researching!=A_NONE)
     {
-      if(get_invention(game.player_ptr, i)!=TECH_REACHABLE)
-       continue;
-
-      if (i==game.player_ptr->research.researching)
-       hist=j;
+      for(i=1, j=0; i<A_LAST; i++)
+      {
+       if(get_invention(game.player_ptr, i)!=TECH_REACHABLE)
+         continue;
+
+       if (i==game.player_ptr->research.researching)
+         hist=j;
+
+       item = gtk_menu_item_new_with_label(advances[i].name);
+       gtk_menu_append(GTK_MENU(popupmenu), item);
+
+       gtk_signal_connect(GTK_OBJECT(item), "activate",
+                          GTK_SIGNAL_FUNC(science_change_callback ), 
(gpointer)i);
+       j++;
+      }
+    }
+    else
+    {
+      sprintf(text, "Researching Future Tech. %d",
+             ((game.player_ptr->future_tech)+1));
 
-      item = gtk_menu_item_new_with_label(advances[i].name);
+      item = gtk_menu_item_new_with_label(text);
       gtk_menu_append(GTK_MENU(popupmenu), item);
-
-      gtk_signal_connect(GTK_OBJECT(item), "activate",
-       GTK_SIGNAL_FUNC(science_change_callback ), (gpointer)i);
-      j++;
     }
-  }
-  else
-  {
-    sprintf(text, "Researching Future Tech. %d",
-       ((game.player_ptr->future_tech)+1));
-
-    item = gtk_menu_item_new_with_label(text);
-    gtk_menu_append(GTK_MENU(popupmenu), item);
-  }
-  gtk_widget_show_all(popupmenu);
-  gtk_menu_set_active(GTK_MENU(popupmenu), hist);
-  gtk_option_menu_set_menu(GTK_OPTION_MENU(science_change_menu_button), 
popupmenu);
-
+    gtk_widget_show_all(popupmenu);
+    gtk_menu_set_active(GTK_MENU(popupmenu), hist);
+    gtk_option_menu_set_menu(GTK_OPTION_MENU(science_change_menu_button), 
popupmenu);
 
-  gtk_widget_destroy(goalmenu);
-  goalmenu = gtk_menu_new();
 
-  sprintf(text, "(%d steps)",
-          tech_goal_turns(game.player_ptr, game.player_ptr->ai.tech_goal));
-  gtk_set_label(science_goal_label,text);
+    gtk_widget_destroy(goalmenu);
+    goalmenu = gtk_menu_new();
 
-  if (game.player_ptr->ai.tech_goal==A_NONE)
-  {
-    item = gtk_menu_item_new_with_label(advances[A_NONE].name);
-    gtk_menu_append(GTK_MENU(goalmenu), item);
-  }
+    sprintf(text, "(%d steps)",
+           tech_goal_turns(game.player_ptr, game.player_ptr->ai.tech_goal));
+    gtk_set_label(science_goal_label,text);
 
-  hist=0;
-  for(i=1, j=0; i<A_LAST; i++)
-  {
-    if(get_invention(game.player_ptr, i) != TECH_KNOWN &&
-       advances[i].req[0] != A_LAST && advances[i].req[1] != A_LAST &&
-       tech_goal_turns(game.player_ptr, i) < 11)
+    if (game.player_ptr->ai.tech_goal==A_NONE)
     {
-      if (i==game.player_ptr->ai.tech_goal)
-        hist=j;
-
-      item = gtk_menu_item_new_with_label(advances[i].name);
+      item = gtk_menu_item_new_with_label(advances[A_NONE].name);
       gtk_menu_append(GTK_MENU(goalmenu), item);
+    }
 
-      gtk_signal_connect(GTK_OBJECT(item), "activate",
-        GTK_SIGNAL_FUNC(science_goal_callback), (gpointer)i);
-      j++;
+    hist=0;
+    for(i=1, j=0; i<A_LAST; i++)
+    {
+      if(get_invention(game.player_ptr, i) != TECH_KNOWN &&
+        advances[i].req[0] != A_LAST && advances[i].req[1] != A_LAST &&
+        tech_goal_turns(game.player_ptr, i) < 11)
+      {
+       if (i==game.player_ptr->ai.tech_goal)
+         hist=j;
+
+       item = gtk_menu_item_new_with_label(advances[i].name);
+       gtk_menu_append(GTK_MENU(goalmenu), item);
+
+       gtk_signal_connect(GTK_OBJECT(item), "activate",
+                          GTK_SIGNAL_FUNC(science_goal_callback), (gpointer)i);
+       j++;
+      }
     }
+    gtk_widget_show_all(goalmenu);
+    gtk_menu_set_active(GTK_MENU(goalmenu), hist);
+    gtk_option_menu_set_menu(GTK_OPTION_MENU(science_goal_menu_button), 
goalmenu);
   }
-  gtk_widget_show_all(goalmenu);
-  gtk_menu_set_active(GTK_MENU(goalmenu), hist);
-  gtk_option_menu_set_menu(GTK_OPTION_MENU(science_goal_menu_button), 
goalmenu);
-  }
-  
+
 }
 
 
 /****************************************************************
 
                       TRADE REPORT DIALOG
- 
+
 ****************************************************************/
 
 /****************************************************************
@@ -453,16 +453,16 @@
 void popup_trade_report_dialog(int make_modal)
 {
   if(!trade_dialog_shell) {
-      trade_dialog_shell_is_modal=make_modal;
-    
-      if(make_modal)
-       gtk_widget_set_sensitive(toplevel, FALSE);
-      
-      create_trade_report_dialog(make_modal);
-      gtk_set_relative_position(toplevel, trade_dialog_shell, 10, 10);
+    trade_dialog_shell_is_modal=make_modal;
+
+    if(make_modal)
+      gtk_widget_set_sensitive(toplevel, FALSE);
+
+    create_trade_report_dialog(make_modal);
+    gtk_set_relative_position(toplevel, trade_dialog_shell, 10, 10);
 
-      gtk_widget_show(trade_dialog_shell);
-   }
+    gtk_widget_show(trade_dialog_shell);
+  }
 }
 
 
@@ -477,10 +477,10 @@
   gint   widths [4] =  { 100, 40, 40, 40 };
   int    i;
   GtkAccelGroup *accel=gtk_accel_group_new();
-  
+
   trade_dialog_shell = gtk_dialog_new();
   gtk_signal_connect( GTK_OBJECT(trade_dialog_shell),"delete_event",
-        GTK_SIGNAL_FUNC(trade_close_callback),NULL );
+                     GTK_SIGNAL_FUNC(trade_close_callback),NULL );
   gtk_accel_group_attach(accel, GTK_OBJECT(trade_dialog_shell));
 
   gtk_window_set_title(GTK_WINDOW(trade_dialog_shell),"Trade Report");
@@ -488,60 +488,61 @@
   report_title=get_report_title("Trade Advisor");
   trade_label = gtk_label_new(report_title);
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(trade_dialog_shell)->vbox ),
-        trade_label, FALSE, FALSE, 0 );
+                     trade_label, FALSE, FALSE, 0 );
 
   trade_list = gtk_clist_new_with_titles( 4, titles );
   gtk_clist_column_titles_passive(GTK_CLIST(trade_list));
   scrolled = gtk_scrolled_window_new(NULL,NULL);
+  gtk_clist_set_selection_mode(GTK_CLIST (trade_list), GTK_SELECTION_EXTENDED);
   gtk_container_add(GTK_CONTAINER(scrolled), trade_list);
   gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled ),
-                         GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+                                 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
   gtk_widget_set_usize(trade_list, 300, 150);
 
   for ( i = 0; i < 4; i++ )
-       gtk_clist_set_column_width(GTK_CLIST(trade_list),i,widths[i]);
+    gtk_clist_set_column_width(GTK_CLIST(trade_list),i,widths[i]);
 
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(trade_dialog_shell)->vbox ),
-        scrolled, TRUE, TRUE, 0 );
+                     scrolled, TRUE, TRUE, 0 );
 
   trade_label2 = gtk_label_new("Total Cost:");
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(trade_dialog_shell)->vbox ),
-        trade_label2, FALSE, FALSE, 0 );
+                     trade_label2, FALSE, FALSE, 0 );
 
   close_command = gtk_button_new_with_label("Close");
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(trade_dialog_shell)->action_area ),
-        close_command, TRUE, TRUE, 0 );
+                     close_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( close_command, GTK_CAN_DEFAULT );
   gtk_widget_grab_default( close_command );
 
   sellobsolete_command = gtk_button_new_with_label("Sell Obsolete");
   gtk_widget_set_sensitive(sellobsolete_command, FALSE);
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(trade_dialog_shell)->action_area ),
-        sellobsolete_command, TRUE, TRUE, 0 );
+                     sellobsolete_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( sellobsolete_command, GTK_CAN_DEFAULT );
 
   sellall_command  = gtk_button_new_with_label("Sell All");
   gtk_widget_set_sensitive(sellall_command, FALSE);
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(trade_dialog_shell)->action_area ),
-        sellall_command, TRUE, TRUE, 0 );
+                     sellall_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( sellall_command, GTK_CAN_DEFAULT );
 
   gtk_signal_connect(GTK_OBJECT(trade_list), "select_row",
-       GTK_SIGNAL_FUNC(trade_list_callback), NULL);
+                    GTK_SIGNAL_FUNC(trade_list_callback), NULL);
   gtk_signal_connect(GTK_OBJECT(trade_list), "unselect_row",
-       GTK_SIGNAL_FUNC(trade_list_ucallback), NULL);
+                    GTK_SIGNAL_FUNC(trade_list_ucallback), NULL);
   gtk_signal_connect(GTK_OBJECT(close_command), "clicked",
-       GTK_SIGNAL_FUNC(trade_close_callback), NULL);
+                    GTK_SIGNAL_FUNC(trade_close_callback), NULL);
   gtk_signal_connect(GTK_OBJECT(sellobsolete_command), "clicked",
-       GTK_SIGNAL_FUNC(trade_selloff_callback), (gpointer)0);
+                    GTK_SIGNAL_FUNC(trade_selloff_callback), (gpointer)0);
   gtk_signal_connect(GTK_OBJECT(sellall_command), "clicked",
-       GTK_SIGNAL_FUNC(trade_selloff_callback), (gpointer)1);
+                    GTK_SIGNAL_FUNC(trade_selloff_callback), (gpointer)1);
 
   gtk_widget_show_all( GTK_DIALOG(trade_dialog_shell)->vbox );
   gtk_widget_show_all( GTK_DIALOG(trade_dialog_shell)->action_area );
 
   gtk_widget_add_accelerator(close_command, "clicked",
-       accel, GDK_Escape, 0, GTK_ACCEL_VISIBLE);
+                            accel, GDK_Escape, 0, GTK_ACCEL_VISIBLE);
 
   trade_report_dialog_update();
 }
@@ -558,7 +559,7 @@
   i=trade_improvement_type[row];
   if(i>=0 && i<B_LAST && !is_wonder(i))
     gtk_widget_set_sensitive(sellobsolete_command, TRUE);
-    gtk_widget_set_sensitive(sellall_command, TRUE);
+  gtk_widget_set_sensitive(sellall_command, TRUE);
   return;
 }
 
@@ -578,7 +579,7 @@
 {
 
   if(trade_dialog_shell_is_modal)
-     gtk_widget_set_sensitive(toplevel, TRUE);
+    gtk_widget_set_sensitive(toplevel, TRUE);
   gtk_widget_destroy(trade_dialog_shell);
   trade_dialog_shell=NULL;
 }
@@ -596,33 +597,34 @@
   GList              *selection;
   gint                row;
 
-  if ( !( selection = GTK_CLIST( trade_list )->selection ) )
-      return;
-
-  row = (gint)selection->data;
+  while((selection = GTK_CLIST(trade_list)->selection) != NULL)
+  {
+    row = (gint)selection->data;
 
-  i=trade_improvement_type[row];
+    i=trade_improvement_type[row];
 
-  genlist_iterator_init(&myiter, &game.player_ptr->cities.list, 0);
-  for(; ITERATOR_PTR(myiter);ITERATOR_NEXT(myiter)) {
-    pcity=(struct city *)ITERATOR_PTR(myiter);
-    if(!pcity->did_sell && city_got_building(pcity, i) && 
-       (data ||
-       improvement_obsolete(game.player_ptr,i) ||
-        wonder_replacement(pcity, i) ))  {
+    genlist_iterator_init(&myiter, &game.player_ptr->cities.list, 0);
+    for(; ITERATOR_PTR(myiter);ITERATOR_NEXT(myiter)) {
+      pcity=(struct city *)ITERATOR_PTR(myiter);
+      if(!pcity->did_sell && city_got_building(pcity, i) &&
+        (data ||
+         improvement_obsolete(game.player_ptr,i) ||
+         wonder_replacement(pcity, i) ))  {
        count++; gold+=improvement_value(i);
-        packet.city_id=pcity->id;
-        packet.build_id=i;
-        packet.name[0]='\0';
-        send_packet_city_request(&aconnection, &packet, PACKET_CITY_SELL);
+       packet.city_id=pcity->id;
+       packet.build_id=i;
+       packet.name[0]='\0';
+       send_packet_city_request(&aconnection, &packet, PACKET_CITY_SELL);
+      };
+    };
+    if(count)  {
+      sprintf(str,"Sold %d %s for %d gold",count,get_improvement_name(i),gold);
+    } else {
+      sprintf(str,"No %s could be sold",get_improvement_name(i));
     };
-  };
-  if(count)  {
-    sprintf(str,"Sold %d %s for %d gold",count,get_improvement_name(i),gold);
-  } else {
-    sprintf(str,"No %s could be sold",get_improvement_name(i));
-  };
-  popup_notify_dialog("Sell-Off Results",str);
+    gtk_clist_unselect_row(GTK_CLIST(trade_list),row,0);
+    popup_notify_dialog("Sell-Off Results",str);
+  }
   return;
 }
 
@@ -642,7 +644,7 @@
     gchar *row  [4];
     char trade_total[48];
     struct city *pcity;
-    
+
     report_title=get_report_title("Trade Advisor");
     gtk_set_label(trade_label, report_title);
     free(report_title);
@@ -661,44 +663,44 @@
     pcity = city_list_get(&game.player_ptr->cities,0);
     if(pcity)  {
       for (j=0;j<B_LAST;j++)
-      if(!is_wonder(j)) {
-       count = 0; 
-       city_list_iterate(game.player_ptr->cities,pcity)
-        if (city_got_building(pcity, j)) count++;
-       city_list_iterate_end;
-       if (!count) continue;
-       cost = count * improvement_upkeep(pcity, j);
-       sprintf( buf0, "%-20s", get_improvement_name(j) );
-       sprintf( buf1, "%5d", count );
-       sprintf( buf2, "%5d", improvement_upkeep(pcity, j) );
-       sprintf( buf3, "%6d", cost );
-
-       gtk_clist_append( GTK_CLIST( trade_list ), row );
-
-       total+=cost;
-       trade_improvement_type[k]=j;
-       k++;
-      }
+       if(!is_wonder(j)) {
+         count = 0;
+         city_list_iterate(game.player_ptr->cities,pcity)
+           if (city_got_building(pcity, j)) count++;
+         city_list_iterate_end;
+         if (!count) continue;
+         cost = count * improvement_upkeep(pcity, j);
+         sprintf( buf0, "%-20s", get_improvement_name(j) );
+         sprintf( buf1, "%5d", count );
+         sprintf( buf2, "%5d", improvement_upkeep(pcity, j) );
+         sprintf( buf3, "%6d", cost );
+
+         gtk_clist_append( GTK_CLIST( trade_list ), row );
+
+         total+=cost;
+         trade_improvement_type[k]=j;
+         k++;
+       }
       city_list_iterate(game.player_ptr->cities,pcity) {
-       tax+=pcity->tax_total;
-       if (!pcity->is_building_unit && 
-          pcity->currently_building==B_CAPITAL)
-        tax+=pcity->shield_surplus;
+       tax+=pcity->tax_total;
+       if (!pcity->is_building_unit &&
+           pcity->currently_building==B_CAPITAL)
+         tax+=pcity->shield_surplus;
       } city_list_iterate_end;
     }
-    sprintf(trade_total, "Income:%6d    Total Costs: %6d", tax, total); 
-    gtk_set_label(trade_label2, trade_total); 
+    sprintf(trade_total, "Income:%6d    Total Costs: %6d", tax, total);
+    gtk_set_label(trade_label2, trade_total);
 
     gtk_widget_show_all(trade_list);
     gtk_clist_thaw(GTK_CLIST(trade_list));
   }
-  
+
 }
 
 /****************************************************************
 
                       ACTIVE UNITS REPORT DIALOG
- 
+
 ****************************************************************/
 
 /****************************************************************
@@ -707,16 +709,16 @@
 void popup_activeunits_report_dialog(int make_modal)
 {
   if(!activeunits_dialog_shell) {
-      activeunits_dialog_shell_is_modal=make_modal;
-    
-      if(make_modal)
-       gtk_widget_set_sensitive(toplevel, FALSE);
-      
-      create_activeunits_report_dialog(make_modal);
-      gtk_set_relative_position(toplevel, activeunits_dialog_shell, 10, 10);
+    activeunits_dialog_shell_is_modal=make_modal;
 
-      gtk_widget_show(activeunits_dialog_shell);
-   }
+    if(make_modal)
+      gtk_widget_set_sensitive(toplevel, FALSE);
+
+    create_activeunits_report_dialog(make_modal);
+    gtk_set_relative_position(toplevel, activeunits_dialog_shell, 10, 10);
+
+    gtk_widget_show(activeunits_dialog_shell);
+  }
 }
 
 
@@ -734,7 +736,7 @@
 
   activeunits_dialog_shell = gtk_dialog_new();
   gtk_signal_connect( GTK_OBJECT(activeunits_dialog_shell),"delete_event",
-        GTK_SIGNAL_FUNC(activeunits_close_callback),NULL );
+                     GTK_SIGNAL_FUNC(activeunits_close_callback),NULL );
   gtk_accel_group_attach(accel, GTK_OBJECT(activeunits_dialog_shell));
 
   gtk_window_set_title(GTK_WINDOW(activeunits_dialog_shell),"Active units 
Report");
@@ -742,7 +744,7 @@
   report_title=get_report_title("Active Units");
   activeunits_label = gtk_label_new(report_title);
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(activeunits_dialog_shell)->vbox ),
-        activeunits_label, FALSE, FALSE, 0 );
+                     activeunits_label, FALSE, FALSE, 0 );
   free(report_title);
 
 
@@ -751,45 +753,45 @@
   scrolled = gtk_scrolled_window_new(NULL,NULL);
   gtk_container_add(GTK_CONTAINER(scrolled),activeunits_list);
   gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled ),
-                         GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+                                 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
   gtk_widget_set_usize(scrolled, 200, 150);
 
   for ( i = 0; i < 3; i++ )
-       gtk_clist_set_column_width(GTK_CLIST(activeunits_list),i,widths[i]);
+    gtk_clist_set_column_width(GTK_CLIST(activeunits_list),i,widths[i]);
 
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(activeunits_dialog_shell)->vbox ),
-        scrolled, TRUE, TRUE, 0 );
+                     scrolled, TRUE, TRUE, 0 );
 
   activeunits_label2 = gtk_label_new("Total Cost:");
   gtk_box_pack_start( GTK_BOX( GTK_DIALOG(activeunits_dialog_shell)->vbox ),
-        activeunits_label2, FALSE, FALSE, 0 );
+                     activeunits_label2, FALSE, FALSE, 0 );
 
   close_command = gtk_button_new_with_label("Close");
   gtk_box_pack_start( GTK_BOX( 
GTK_DIALOG(activeunits_dialog_shell)->action_area ),
-        close_command, TRUE, TRUE, 0 );
+                     close_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( close_command, GTK_CAN_DEFAULT );
   gtk_widget_grab_default( close_command );
 
   upgrade_command = gtk_button_new_with_label("Upgrade");
   gtk_widget_set_sensitive(upgrade_command, FALSE);
   gtk_box_pack_start( GTK_BOX( 
GTK_DIALOG(activeunits_dialog_shell)->action_area ),
-        upgrade_command, TRUE, TRUE, 0 );
+                     upgrade_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( upgrade_command, GTK_CAN_DEFAULT );
 
   gtk_signal_connect(GTK_OBJECT(activeunits_list), "select_row",
-       GTK_SIGNAL_FUNC(activeunits_list_callback), NULL);
+                    GTK_SIGNAL_FUNC(activeunits_list_callback), NULL);
   gtk_signal_connect(GTK_OBJECT(activeunits_list), "unselect_row",
-       GTK_SIGNAL_FUNC(activeunits_list_ucallback), NULL);
+                    GTK_SIGNAL_FUNC(activeunits_list_ucallback), NULL);
   gtk_signal_connect(GTK_OBJECT(close_command), "clicked",
-       GTK_SIGNAL_FUNC(activeunits_close_callback), NULL);
+                    GTK_SIGNAL_FUNC(activeunits_close_callback), NULL);
   gtk_signal_connect(GTK_OBJECT(upgrade_command), "clicked",
-       GTK_SIGNAL_FUNC(activeunits_upgrade_callback), NULL);
+                    GTK_SIGNAL_FUNC(activeunits_upgrade_callback), NULL);
 
   gtk_widget_show_all( GTK_DIALOG(activeunits_dialog_shell)->vbox );
   gtk_widget_show_all( GTK_DIALOG(activeunits_dialog_shell)->action_area );
 
   gtk_widget_add_accelerator(close_command, "clicked",
-       accel, GDK_Escape, 0, GTK_ACCEL_VISIBLE);
+                            accel, GDK_Escape, 0, GTK_ACCEL_VISIBLE);
 
   activeunits_report_dialog_update();
 }
@@ -799,7 +801,7 @@
 *****************************************************************/
 void activeunits_list_callback(GtkWidget *w, gint row, gint column)
 {
-  if (can_upgrade_unittype(game.player_ptr, activeunits_type[row]) != -1) 
+  if (can_upgrade_unittype(game.player_ptr, activeunits_type[row]) != -1)
     gtk_widget_set_sensitive(upgrade_command, TRUE);
 }
 
@@ -839,15 +841,15 @@
   gint                row;
 
   if ( !( selection = GTK_CLIST( activeunits_list )->selection ) )
-      return;
+    return;
 
   row = (gint)selection->data;
 
   ut1 = activeunits_type[row];
   puts(unit_types[ut1].name);
-  
+
   ut2 = can_upgrade_unittype(game.player_ptr, activeunits_type[row]);
-  
+
   sprintf(buf, "upgrade as many %s to %s as possible for %d gold 
each?\nTreasury contains %d gold.", unit_types[ut1].name, unit_types[ut2].name, 
unit_upgrade_price(game.player_ptr, ut1, ut2), game.player_ptr->economic.gold);
   popup_message_dialog(toplevel, /*"upgradedialog"*/"Upgrade Obsolete Units", 
buf,
                       "Yes", upgrade_callback_yes, 
(gpointer)(activeunits_type[row]),
@@ -861,9 +863,9 @@
 {
 
   if(activeunits_dialog_shell_is_modal)
-     gtk_widget_set_sensitive(toplevel, TRUE);
-   gtk_widget_destroy(activeunits_dialog_shell);
-   activeunits_dialog_shell=0;
+    gtk_widget_set_sensitive(toplevel, TRUE);
+  gtk_widget_destroy(activeunits_dialog_shell);
+  activeunits_dialog_shell=0;
 }
 
 /****************************************************************
@@ -879,8 +881,8 @@
     gchar *row [3];
     char   buf0        [64];
     char   buf2        [64];
-    
-  if(delay_report_update) return;
+
+    if(delay_report_update) return;
     report_title=get_report_title("Active Units");
     gtk_set_label(activeunits_label, report_title);
     free(report_title);
@@ -891,9 +893,9 @@
     row[0] = buf0;
     row[2] = buf2;
 
-    for (i=0;i <U_LAST;i++) 
+    for (i=0;i <U_LAST;i++)
       unit_count[i]=0;
-    unit_list_iterate(game.player_ptr->units, punit) 
+    unit_list_iterate(game.player_ptr->units, punit)
       unit_count[punit->type]++;
     unit_list_iterate_end;
     k = 0;
@@ -912,9 +914,9 @@
       }
     }
 
-    sprintf(activeunits_total, "Total units:%21d",total); 
+    sprintf(activeunits_total, "Total units:%21d",total);
 
-    gtk_set_label(activeunits_label2, activeunits_total); 
+    gtk_set_label(activeunits_label2, activeunits_total);
 
     gtk_widget_show_all(activeunits_list);
     gtk_clist_thaw(GTK_CLIST(activeunits_list));
diff --unified --recursive --new-file --exclude-from=.diffignore 
freeciv-cvs/client/gui-gtk/repodlgs.h freeciv/client/gui-gtk/repodlgs.h
--- freeciv-cvs/client/gui-gtk/repodlgs.h       Tue Apr 13 15:14:40 1999
+++ freeciv/client/gui-gtk/repodlgs.h   Fri May 21 09:43:34 1999
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -10,19 +10,19 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 ***********************************************************************/
-#ifndef __REPODLGS_H
-#define __REPODLGS_H
+#ifndef FC__REPODLGS_H
+#define FC__REPODLGS_H
 
-void report_update_delay_on();
-void report_update_delay_off();
+void report_update_delay_on(void);
+void report_update_delay_off(void);
 char *get_report_title(char *report_name);
-void update_report_dialogs();
+void update_report_dialogs(void);
 
 void science_dialog_update(void);
 void popup_science_dialog(int make_modal);
-void trade_report_dialog_update();
+void trade_report_dialog_update(void);
 void popup_trade_report_dialog(int make_modal);
-void activeunits_report_dialog_update();
+void activeunits_report_dialog_update(void);
 void popup_activeunits_report_dialog(int make_modal);
 
-#endif
+#endif  /* FC__REPODLGS_H */
diff --unified --recursive --new-file --exclude-from=.diffignore 
freeciv-cvs/client/include/cityrep.h freeciv/client/include/cityrep.h
--- freeciv-cvs/client/include/cityrep.h        Mon Apr 26 12:27:44 1999
+++ freeciv/client/include/cityrep.h    Fri May 21 09:43:34 1999
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
 struct city;
 
 void popup_city_report_dialog(int make_modal);
-void city_report_dialog_update();
+void city_report_dialog_update(void);
 void city_report_dialog_update_city(struct city *pcity);
 
 /* These are wanted to save/load options; use wrappers rather than
diff --unified --recursive --new-file --exclude-from=.diffignore 
freeciv-cvs/server/cityturn.c freeciv/server/cityturn.c
--- freeciv-cvs/server/cityturn.c       Sat May 15 07:55:25 1999
+++ freeciv/server/cityturn.c   Fri May 21 09:43:34 1999
@@ -61,7 +61,7 @@
 static void city_increase_size(struct city *pcity);
 static void city_reduce_size(struct city *pcity);
 
-static void city_build_stuff(struct player *pplayer, struct city *pcity);
+static int city_build_stuff(struct player *pplayer, struct city *pcity);
 static void upgrade_building_prod(struct city *pcity);
 static void upgrade_unit_prod(struct city *pcity);
 static void obsolete_building_test(struct city *pcity, int b1, int b2);
@@ -949,7 +949,7 @@
 /**************************************************************************
 ...
 **************************************************************************/
-void city_build_stuff(struct player *pplayer, struct city *pcity)
+int city_build_stuff(struct player *pplayer, struct city *pcity)
 {
   int space_part;
   
@@ -979,7 +979,7 @@
       notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
                    "Game: %s is building %s, which is no longer available",
        pcity->name,get_imp_name_ex(pcity, pcity->currently_building));
-      return;
+      return 0;
     }
     if (pcity->shield_stock>=improvement_value(pcity->currently_building)) {
       if (pcity->currently_building==B_PALACE) {
@@ -1060,11 +1060,12 @@
          /* Should we disband the city? -- Massimo */
          if (pcity->city_options & ((1<<CITYO_DISBAND))) {
            disband_city(pcity);
+           return 1;
          } else {
            notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
                             "Game: %s can't build settler yet", pcity->name);
          }
-         return;
+         return 0;
 
        }
        pcity->size--;
@@ -1088,6 +1089,7 @@
 
     }
   }
+  return 0;
 }
 
 /**************************************************************************
@@ -1272,7 +1274,11 @@
     if (!ai_make_elvis(pcity)) break;
   } /* putting this lower in the routine would basically be cheating. -- Syela 
*/
 
-  city_build_stuff(pplayer, pcity);
+  if (city_build_stuff(pplayer, pcity))
+  {
+      /* City was deleted */
+      return 0;
+  }
   if (!pcity->was_happy && city_happy(pcity) && pcity->size>4) {
     notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_LOVE,
                  "Game: We Love The %s Day celebrated in %s", 

[Prev in Thread] Current Thread [Next in Thread]