Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11342) GUI should know that we can't buy
Home

[Freeciv-Dev] (PR#11342) GUI should know that we can't buy

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11342) GUI should know that we can't buy
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 4 Dec 2004 20:40:09 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=11342 >

This patch fixes city_can_buy().  However it makes no difference in the
gtk2 client; presumably city_can_buy() isn't checked.

-jason

Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.51
diff -u -r1.51 citydlg_common.c
--- client/citydlg_common.c     30 Nov 2004 08:37:02 -0000      1.51
+++ client/citydlg_common.c     5 Dec 2004 04:39:05 -0000
@@ -608,8 +608,16 @@
 **************************************************************************/
 bool city_can_buy(const struct city *pcity)
 {
+  /* See really_handle_city_buy() in the server.  However this function
+   * doesn't allow for error messages.  It doesn't check the cost of
+   * buying; that's handled separately (and with an error message). */
   return (can_client_issue_orders()
+         && pcity
+         && pcity->owner == game.player_idx
+         && pcity->turn_founded != game.turn
          && !pcity->did_buy
+         && get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) <= 0
+         && !(pcity->is_building_unit && pcity->anarchy != 0)
          && city_buy_cost(pcity) > 0);
 }
 
Index: server/cityhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityhand.c,v
retrieving revision 1.137
diff -u -r1.137 cityhand.c
--- server/cityhand.c   29 Sep 2004 02:24:23 -0000      1.137
+++ server/cityhand.c   5 Dec 2004 04:39:06 -0000
@@ -210,6 +210,8 @@
   const char *name;
   int cost, total;
 
+  /* This function corresponds to city_can_buy() in the client. */
+
   assert(pcity && player_owns_city(pplayer, pcity));
  
   if (pcity->turn_founded == game.turn) {

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