Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11477) gen imprs
Home

[Freeciv-Dev] (PR#11477) gen imprs

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11477) gen imprs
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Sun, 19 Dec 2004 10:51:50 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11477 >

Here is a patch that should add gen imprs support to gui-xaw, gui-win32
and gui-gtk. Caveat emptor: it was not well tested. But it is better
than nothing so in it goes.

Index: gui-gtk/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.191
diff -u -r1.191 citydlg.c
--- gui-gtk/citydlg.c   13 Dec 2004 16:23:29 -0000      1.191
+++ gui-gtk/citydlg.c   19 Dec 2004 18:49:11 -0000
@@ -2972,7 +2972,7 @@
 
     if (cid_is_unit(cid)) {
       popup_help_dialog_typed(get_unit_type(id)->name, HELP_UNIT);
-    } else if (is_wonder(id)) {
+    } else if (is_great_wonder(id)) {
       popup_help_dialog_typed(get_improvement_name(id), HELP_WONDER);
     } else {
       popup_help_dialog_typed(get_improvement_name(id), HELP_IMPROVEMENT);
@@ -3000,7 +3000,7 @@
                       (GTK_CLIST(pdialog->overview.improvement_list),
                        GPOINTER_TO_INT(selection->data)));
   assert(city_got_building(pdialog->pcity, id));
-  if (is_wonder(id))
+  if (!can_sell_improvement(id))
     return;
 
   pdialog->sell_id = id;
@@ -3057,7 +3057,7 @@
                              GPOINTER_TO_INT(selection->data)));
     assert(city_got_building(pdialog->pcity, id));
 
-    if (!is_wonder(id)) {
+    if (can_sell_improvement(id)) {
       char buf[64];
       my_snprintf(buf, sizeof(buf), _("Sell (worth %d gold)"),
                  impr_sell_gold(id));
@@ -3116,7 +3116,7 @@
     /* Very special case: If we are currently building a wonder we
        allow the construction to continue, even if we the wonder is
        finished elsewhere, ie unbuildable. */
-    if (k == 0 && !is_unit && is_wonder(id) && same_as_current_build) {
+    if (k == 0 && !is_unit && is_great_wonder(id) && same_as_current_build) {
       worklist_remove(pwl, k);
       break;
     }
Index: gui-gtk/cityrep.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/cityrep.c,v
retrieving revision 1.87
diff -u -r1.87 cityrep.c
--- gui-gtk/cityrep.c   30 Nov 2004 06:54:06 -0000      1.87
+++ gui-gtk/cityrep.c   19 Dec 2004 18:49:12 -0000
@@ -826,9 +826,9 @@
 
     if ( (which == TYPE_UNIT && pcity->is_building_unit)
          || (which == TYPE_NORMAL_IMPROVEMENT && !pcity->is_building_unit
-             && !is_wonder(pcity->currently_building))
+             && !is_great_wonder(pcity->currently_building))
          || (which == TYPE_WONDER && !pcity->is_building_unit
-             && is_wonder(pcity->currently_building)) ) {
+             && is_great_wonder(pcity->currently_building)) ) {
       gtk_clist_select_row(GTK_CLIST(city_list), i, 0);
     }
   }
Index: gui-gtk/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/helpdlg.c,v
retrieving revision 1.72
diff -u -r1.72 helpdlg.c
--- gui-gtk/helpdlg.c   29 Nov 2004 20:56:51 -0000      1.72
+++ gui-gtk/helpdlg.c   19 Dec 2004 18:49:12 -0000
@@ -833,7 +833,7 @@
         w = gtk_label_new(_("Allows "));
         gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
         w = help_slink_new(improvement_types[j].name,
-                         is_wonder(j)?HELP_WONDER:HELP_IMPROVEMENT);
+                         is_great_wonder(j)?HELP_WONDER:HELP_IMPROVEMENT);
         gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
         w = gtk_label_new(Q_("?techhelp:."));
         gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
@@ -844,7 +844,7 @@
         w = gtk_label_new(_("Obsoletes "));
         gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
         w = help_slink_new(improvement_types[j].name,
-                         is_wonder(j)?HELP_WONDER:HELP_IMPROVEMENT);
+                         is_great_wonder(j)?HELP_WONDER:HELP_IMPROVEMENT);
         gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
         w = gtk_label_new(Q_("?techhelp:."));
         gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
@@ -1064,12 +1064,12 @@
   switch(pitem->type) {
   case HELP_IMPROVEMENT:
     i = find_improvement_by_name(top);
-    if(i!=B_LAST && is_wonder(i)) i = B_LAST;
+    if(i!=B_LAST && is_great_wonder(i)) i = B_LAST;
     help_update_improvement(pitem, top, i);
     break;
   case HELP_WONDER:
     i = find_improvement_by_name(top);
-    if(i!=B_LAST && !is_wonder(i)) i = B_LAST;
+    if(i!=B_LAST && !is_great_wonder(i)) i = B_LAST;
     help_update_wonder(pitem, top, i);
     break;
   case HELP_UNIT:
Index: gui-gtk/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/repodlgs.c,v
retrieving revision 1.87
diff -u -r1.87 repodlgs.c
--- gui-gtk/repodlgs.c  6 Dec 2004 18:01:14 -0000       1.87
+++ gui-gtk/repodlgs.c  19 Dec 2004 18:49:12 -0000
@@ -665,7 +665,7 @@
   int i = economy_row_type[row].type;
   
   if (economy_row_type[row].is_impr == TRUE) {
-    bool is_sellable = (i >= 0 && i < game.num_impr_types && !is_wonder(i));
+    bool is_sellable = (improvement_exists(i) && can_sell_improvement(i));
 
     gtk_widget_set_sensitive(sellobsolete_command, is_sellable
                             && can_client_issue_orders()
Index: gui-gtk/wldlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/wldlg.c,v
retrieving revision 1.36
diff -u -r1.36 wldlg.c
--- gui-gtk/wldlg.c     8 Apr 2004 18:19:09 -0000       1.36
+++ gui-gtk/wldlg.c     19 Dec 2004 18:49:13 -0000
@@ -1437,7 +1437,7 @@
   if (id >= 0) {
     if (is_unit) {
       popup_help_dialog_typed(get_unit_type(id)->name, HELP_UNIT);
-    } else if (is_wonder(id)) {
+    } else if (is_great_wonder(id)) {
       popup_help_dialog_typed(get_improvement_name(id), HELP_WONDER);
     } else {
       popup_help_dialog_typed(get_improvement_name(id), HELP_IMPROVEMENT);
Index: gui-win32/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/citydlg.c,v
retrieving revision 1.90
diff -u -r1.90 citydlg.c
--- gui-win32/citydlg.c 13 Dec 2004 16:23:29 -0000      1.90
+++ gui-win32/citydlg.c 19 Dec 2004 18:49:13 -0000
@@ -964,7 +964,7 @@
     return;
   }
  
-  if (is_wonder(pdialog->id_selected)) {
+  if (!can_sell_building(pdialog->pcity, pdialog->id_selected)) {
     return;
   }
   
@@ -1027,7 +1027,7 @@
              if (is_unit) {
                popup_help_dialog_typed(get_unit_type(idx)->name,
                                        HELP_UNIT);
-             } else if(is_wonder(idx)) {
+             } else if(is_great_wonder(idx)) {
                popup_help_dialog_typed(get_improvement_name(idx),
                                        HELP_WONDER);
              } else {
@@ -1169,7 +1169,7 @@
     /* Very special case: If we are currently building a wonder we
        allow the construction to continue, even if we the wonder is
        finished elsewhere, ie unbuildable. */
-    if (k == 0 && !is_unit && is_wonder(id) && same_as_current_build) {
+    if (k == 0 && !is_unit && is_great_wonder(id) && same_as_current_build) {
       worklist_remove(pwl, k);
       break;
     }
Index: gui-win32/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/helpdlg.c,v
retrieving revision 1.24
diff -u -r1.24 helpdlg.c
--- gui-win32/helpdlg.c 29 Nov 2004 20:56:51 -0000      1.24
+++ gui-win32/helpdlg.c 19 Dec 2004 18:49:14 -0000
@@ -759,7 +759,7 @@
        fcwin_box_add_box(helpdlg_page_vbox,hbox,FALSE,FALSE,5);
        fcwin_box_add_static(hbox,_("Allows "),0,SS_LEFT,FALSE,FALSE,5);
        fcwin_box_add_button(hbox,improvement_types[j].name,
-                            is_wonder(j)?
+                            is_great_wonder(j)?
                             ID_HELP_WONDER_LINK:ID_HELP_IMPROVEMENT_LINK,
                             0,FALSE,FALSE,5);
       }
@@ -768,7 +768,7 @@
        fcwin_box_add_box(helpdlg_page_vbox,hbox,FALSE,FALSE,5);
        fcwin_box_add_static(hbox,_("Obsoletes "),0,SS_LEFT,FALSE,FALSE,5);
        fcwin_box_add_button(hbox,improvement_types[j].name,
-                            is_wonder(j)?
+                            is_great_wonder(j)?
                             ID_HELP_WONDER_LINK:ID_HELP_IMPROVEMENT_LINK,
                             0,FALSE,FALSE,5);
       }
@@ -855,12 +855,12 @@
   switch(pitem->type) {
   case HELP_IMPROVEMENT:
     i = find_improvement_by_name(top);
-    if(i!=B_LAST && is_wonder(i)) i = B_LAST;
+    if(i!=B_LAST && is_great_wonder(i)) i = B_LAST;
     help_update_improvement(pitem, top, i);
     break;
   case HELP_WONDER:
     i = find_improvement_by_name(top);
-    if(i!=B_LAST && !is_wonder(i)) i = B_LAST;
+    if(i!=B_LAST && !is_great_wonder(i)) i = B_LAST;
     help_update_wonder(pitem, top, i);
     break;
   case HELP_UNIT:
Index: gui-win32/wldlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/wldlg.c,v
retrieving revision 1.16
diff -u -r1.16 wldlg.c
--- gui-win32/wldlg.c   14 Nov 2002 09:14:59 -0000      1.16
+++ gui-win32/wldlg.c   19 Dec 2004 18:49:14 -0000
@@ -337,7 +337,7 @@
   if (id >= 0) {
     if (is_unit) {
       popup_help_dialog_typed(get_unit_type(id)->name, HELP_UNIT);
-    } else if (is_wonder(id)) {
+    } else if (is_great_wonder(id)) {
       popup_help_dialog_typed(get_improvement_name(id), HELP_WONDER);
     } else {
       popup_help_dialog_typed(get_improvement_name(id), HELP_IMPROVEMENT);
Index: gui-xaw/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/citydlg.c,v
retrieving revision 1.127
diff -u -r1.127 citydlg.c
--- gui-xaw/citydlg.c   13 Dec 2004 16:23:29 -0000      1.127
+++ gui-xaw/citydlg.c   19 Dec 2004 18:49:15 -0000
@@ -2023,7 +2023,7 @@
 
     if (is_unit) {
       popup_help_dialog_typed(get_unit_type(idx)->name, HELP_UNIT);
-    } else if(is_wonder(idx)) {
+    } else if(is_great_wonder(idx)) {
       popup_help_dialog_typed(get_improvement_name(idx), HELP_WONDER);
     } else {
       popup_help_dialog_typed(get_improvement_name(idx), HELP_IMPROVEMENT);
@@ -2213,7 +2213,7 @@
     /* Very special case: If we are currently building a wonder we
        allow the construction to continue, even if we the wonder is
        finished elsewhere, ie unbuildable. */
-    if (k == 0 && !is_unit && is_wonder(id) && same_as_current_build) {
+    if (k == 0 && !is_unit && is_great_wonder(id) && same_as_current_build) {
       worklist_remove(pwl, k);
       break;
     }
@@ -2288,7 +2288,7 @@
       if (n == ret->list_index) {
        char buf[512];
 
-       if (is_wonder(i)) {
+       if (!can_sell_building(pdialog->pcity, i)) {
          return;
        }
 
Index: gui-xaw/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/helpdlg.c,v
retrieving revision 1.56
diff -u -r1.56 helpdlg.c
--- gui-xaw/helpdlg.c   29 Nov 2004 20:56:51 -0000      1.56
+++ gui-xaw/helpdlg.c   19 Dec 2004 18:49:16 -0000
@@ -1087,12 +1087,12 @@
   switch(pitem->type) {
   case HELP_IMPROVEMENT:
     i = find_improvement_by_name(top);
-    if(i!=B_LAST && is_wonder(i)) i = B_LAST;
+    if(i!=B_LAST && is_great_wonder(i)) i = B_LAST;
     help_update_improvement(pitem, top, i);
     break;
   case HELP_WONDER:
     i = find_improvement_by_name(top);
-    if(i!=B_LAST && !is_wonder(i)) i = B_LAST;
+    if(i!=B_LAST && !is_great_wonder(i)) i = B_LAST;
     help_update_wonder(pitem, top, i);
     break;
   case HELP_UNIT:
Index: gui-xaw/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/repodlgs.c,v
retrieving revision 1.65
diff -u -r1.65 repodlgs.c
--- gui-xaw/repodlgs.c  6 Dec 2004 18:01:14 -0000       1.65
+++ gui-xaw/repodlgs.c  19 Dec 2004 18:49:16 -0000
@@ -703,7 +703,7 @@
   if (ret->list_index != XAW_LIST_NONE) {
     /* The user has selected an improvement type. */
     int i = economy_improvement_type[ret->list_index];
-    bool is_sellable = (i >= 0 && i < game.num_impr_types && !is_wonder(i));
+    bool is_sellable = (improvement_exists(i) && can_sell_improvement(i));
 
     XtSetSensitive(sellobsolete_command, is_sellable
                   && improvement_obsolete(game.player_ptr, i));
Index: gui-xaw/wldlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/wldlg.c,v
retrieving revision 1.25
diff -u -r1.25 wldlg.c
--- gui-xaw/wldlg.c     16 Sep 2004 15:58:40 -0000      1.25
+++ gui-xaw/wldlg.c     19 Dec 2004 18:49:18 -0000
@@ -1200,7 +1200,7 @@
   if(id >= 0) {
     if (is_unit) {
       popup_help_dialog_typed(get_unit_type(id)->name, HELP_UNIT);
-    } else if(is_wonder(id)) {
+    } else if(is_great_wonder(id)) {
       popup_help_dialog_typed(get_improvement_name(id), HELP_WONDER);
     } else {
       popup_help_dialog_typed(get_improvement_name(id), HELP_IMPROVEMENT);

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