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

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

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11477) META-TICKET: gen imprs
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Mon, 20 Dec 2004 20:13:15 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Fri Dec 17 08:37:28 2004]:
> 
> - The names of can_sell_improvement and can_sell_building are too
> indistinguishable.  I think they should be can_sell_building and
> can_city_sell_building.

Here is a patch that renames them to can_sell_building and
can_city_sell_building. 

Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.186
diff -u -r1.186 aicity.c
--- ai/aicity.c 19 Dec 2004 16:47:08 -0000      1.186
+++ ai/aicity.c 21 Dec 2004 04:11:07 -0000
@@ -781,7 +781,7 @@
 static void try_to_sell_stuff(struct player *pplayer, struct city *pcity)
 {
   impr_type_iterate(id) {
-    if (can_sell_building(pcity, id)
+    if (can_city_sell_building(pcity, id)
        && !building_has_effect(id, EFT_LAND_DEFEND)) {
 /* selling walls to buy defenders is counterproductive -- Syela */
       really_handle_city_sell(pplayer, pcity, id);
@@ -1045,7 +1045,7 @@
   struct player *pplayer = city_owner(pcity);
 
   built_impr_iterate(pcity, i) {
-    if(can_sell_building(pcity, i) 
+    if(can_city_sell_building(pcity, i) 
        && !building_has_effect(i, EFT_LAND_DEFEND)
              /* selling city walls is really, really dumb -- Syela */
        && (is_building_replaced(pcity, i)
Index: client/gui-gtk/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.192
diff -u -r1.192 citydlg.c
--- client/gui-gtk/citydlg.c    19 Dec 2004 18:53:12 -0000      1.192
+++ client/gui-gtk/citydlg.c    21 Dec 2004 04:11:16 -0000
@@ -3000,7 +3000,7 @@
                       (GTK_CLIST(pdialog->overview.improvement_list),
                        GPOINTER_TO_INT(selection->data)));
   assert(city_got_building(pdialog->pcity, id));
-  if (!can_sell_improvement(id))
+  if (!can_city_sell_building(pdialog->pcity, id))
     return;
 
   pdialog->sell_id = id;
@@ -3057,7 +3057,7 @@
                              GPOINTER_TO_INT(selection->data)));
     assert(city_got_building(pdialog->pcity, id));
 
-    if (can_sell_improvement(id)) {
+    if (can_city_sell_building(pdialog->pcity, id)) {
       char buf[64];
       my_snprintf(buf, sizeof(buf), _("Sell (worth %d gold)"),
                  impr_sell_gold(id));
Index: client/gui-gtk/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/repodlgs.c,v
retrieving revision 1.88
diff -u -r1.88 repodlgs.c
--- client/gui-gtk/repodlgs.c   19 Dec 2004 18:53:12 -0000      1.88
+++ client/gui-gtk/repodlgs.c   21 Dec 2004 04:11:21 -0000
@@ -665,7 +665,7 @@
   int i = economy_row_type[row].type;
   
   if (economy_row_type[row].is_impr == TRUE) {
-    bool is_sellable = (improvement_exists(i) && can_sell_improvement(i));
+    bool is_sellable = (improvement_exists(i) && can_sell_building(i));
 
     gtk_widget_set_sensitive(sellobsolete_command, is_sellable
                             && can_client_issue_orders()
Index: client/gui-gtk-2.0/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/citydlg.c,v
retrieving revision 1.107
diff -u -r1.107 citydlg.c
--- client/gui-gtk-2.0/citydlg.c        19 Dec 2004 16:47:08 -0000      1.107
+++ client/gui-gtk-2.0/citydlg.c        21 Dec 2004 04:11:22 -0000
@@ -2397,7 +2397,7 @@
     return;
   }
   
-  if (!can_sell_building(pdialog->pcity, id)) {
+  if (!can_city_sell_building(pdialog->pcity, id)) {
     return;
   }
 
Index: client/gui-gtk-2.0/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/repodlgs.c,v
retrieving revision 1.74
diff -u -r1.74 repodlgs.c
--- client/gui-gtk-2.0/repodlgs.c       19 Dec 2004 16:47:08 -0000      1.74
+++ client/gui-gtk-2.0/repodlgs.c       21 Dec 2004 04:11:27 -0000
@@ -730,7 +730,7 @@
   if (row >= 0) {
     if (economy_row_type[row].is_impr == TRUE) {
       /* The user has selected an improvement type. */
-      bool is_sellable = (improvement_exists(i) && can_sell_improvement(i));
+      bool is_sellable = (improvement_exists(i) && can_sell_building(i));
 
       gtk_widget_set_sensitive(sellobsolete_command, is_sellable
                               && can_client_issue_orders()
Index: client/gui-win32/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/citydlg.c,v
retrieving revision 1.91
diff -u -r1.91 citydlg.c
--- client/gui-win32/citydlg.c  19 Dec 2004 18:53:13 -0000      1.91
+++ client/gui-win32/citydlg.c  21 Dec 2004 04:11:29 -0000
@@ -964,7 +964,7 @@
     return;
   }
  
-  if (!can_sell_building(pdialog->pcity, pdialog->id_selected)) {
+  if (!can_city_sell_building(pdialog->pcity, pdialog->id_selected)) {
     return;
   }
   
Index: client/gui-xaw/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/citydlg.c,v
retrieving revision 1.129
diff -u -r1.129 citydlg.c
--- client/gui-xaw/citydlg.c    19 Dec 2004 19:18:07 -0000      1.129
+++ client/gui-xaw/citydlg.c    21 Dec 2004 04:11:34 -0000
@@ -2288,7 +2288,7 @@
       if (n == ret->list_index) {
        char buf[512];
 
-       if (!can_sell_building(pdialog->pcity, i)) {
+       if (!can_city_sell_building(pdialog->pcity, i)) {
          return;
        }
 
Index: client/gui-xaw/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/repodlgs.c,v
retrieving revision 1.66
diff -u -r1.66 repodlgs.c
--- client/gui-xaw/repodlgs.c   19 Dec 2004 18:53:15 -0000      1.66
+++ client/gui-xaw/repodlgs.c   21 Dec 2004 04:11:38 -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 = (improvement_exists(i) && can_sell_improvement(i));
+    bool is_sellable = (improvement_exists(i) && can_sell_building(i));
 
     XtSetSensitive(sellobsolete_command, is_sellable
                   && improvement_obsolete(game.player_ptr, i));
Index: common/improvement.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/improvement.c,v
retrieving revision 1.50
diff -u -r1.50 improvement.c
--- common/improvement.c        21 Dec 2004 03:36:18 -0000      1.50
+++ common/improvement.c        21 Dec 2004 04:11:41 -0000
@@ -416,7 +416,7 @@
 /**************************************************************************
   Return TRUE iff the improvement can be sold.
 **************************************************************************/
-bool can_sell_improvement(Impr_Type_id id)
+bool can_sell_building(Impr_Type_id id)
 {
   return is_improvement(id);
 }
@@ -424,8 +424,8 @@
 /****************************************************************************
   Return TRUE iff the city can sell the given improvement.
 ****************************************************************************/
-bool can_sell_building(struct city *pcity, Impr_Type_id id)
+bool can_city_sell_building(struct city *pcity, Impr_Type_id id)
 {
-  return (city_got_building(pcity, id) ? can_sell_improvement(id) : FALSE);
+  return (city_got_building(pcity, id) ? can_sell_building(id) : FALSE);
 }
 
Index: common/improvement.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/improvement.h,v
retrieving revision 1.37
diff -u -r1.37 improvement.h
--- common/improvement.h        21 Dec 2004 03:36:18 -0000      1.37
+++ common/improvement.h        21 Dec 2004 04:11:41 -0000
@@ -129,8 +129,6 @@
   }                                                                           \
 }
 
-bool can_sell_building(struct city *pcity, Impr_Type_id id);
-
 bool is_great_wonder(Impr_Type_id id);
 bool is_small_wonder(Impr_Type_id id);
 bool is_improvement(Impr_Type_id id);
@@ -140,7 +138,9 @@
                                         Impr_Type_id id);
 
 bool great_wonder_was_built(Impr_Type_id id);
-bool can_sell_improvement(Impr_Type_id id);
+
+bool can_sell_building(Impr_Type_id id);
+bool can_city_sell_building(struct city *pcity, Impr_Type_id id);
 
 #endif  /* FC__IMPROVEMENT_H */
 
Index: server/cityhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityhand.c,v
retrieving revision 1.138
diff -u -r1.138 cityhand.c
--- server/cityhand.c   8 Dec 2004 04:28:26 -0000       1.138
+++ server/cityhand.c   21 Dec 2004 04:11:48 -0000
@@ -172,7 +172,7 @@
     return;
   }
 
-  if (!can_sell_building(pcity, id))
+  if (!can_city_sell_building(pcity, id))
     return;
 
   pcity->did_sell=TRUE;
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.295
diff -u -r1.295 citytools.c
--- server/citytools.c  19 Dec 2004 16:47:10 -0000      1.295
+++ server/citytools.c  21 Dec 2004 04:11:49 -0000
@@ -1722,7 +1722,7 @@
 void do_sell_building(struct player *pplayer, struct city *pcity,
                      Impr_Type_id id)
 {
-  if (can_sell_building(pcity, id)) {
+  if (can_city_sell_building(pcity, id)) {
     pplayer->economic.gold += impr_sell_gold(id);
     building_lost(pcity, id);
   }
@@ -2051,7 +2051,7 @@
       built_impr_iterate(pcity, impr) {
         int i = 0;
 
-        if (!can_sell_building(pcity, impr)) {
+        if (!can_city_sell_building(pcity, impr)) {
           continue;
         }
 
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.288
diff -u -r1.288 cityturn.c
--- server/cityturn.c   19 Dec 2004 16:47:10 -0000      1.288
+++ server/cityturn.c   21 Dec 2004 04:11:50 -0000
@@ -114,7 +114,7 @@
   bool sold = FALSE;
 
   built_impr_iterate(pcity, i) {
-    if (can_sell_building(pcity, i) && improvement_obsolete(pplayer, i)) {
+    if (can_city_sell_building(pcity, i) && improvement_obsolete(pplayer, i)) {
       do_sell_building(pplayer, pcity, i);
       notify_player_ex(pplayer, pcity->tile, E_IMP_SOLD, 
                       _("Game: %s is selling %s (obsolete) for %d."),
@@ -1144,7 +1144,7 @@
 static void pay_for_buildings(struct player *pplayer, struct city *pcity)
 {
   built_impr_iterate(pcity, i) {
-    if (can_sell_building(pcity, i)
+    if (can_city_sell_building(pcity, i)
        && pplayer->government != game.government_when_anarchy) {
       if (pplayer->economic.gold - improvement_upkeep(pcity, i) < 0) {
        notify_player_ex(pplayer, pcity->tile, E_IMP_AUCTIONED,

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