Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9401) remove improvement_upkeep_asmiths()
Home

[Freeciv-Dev] (PR#9401) remove improvement_upkeep_asmiths()

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9401) remove improvement_upkeep_asmiths()
From: "Jason Dorje Short" <jdorje@xxxxxxxxxxx>
Date: Thu, 15 Jul 2004 21:26:57 -0700
Reply-to: rt@xxxxxxxxxxx

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

city_gold_surplus() has an optimization: it calls 
city_affected_by_wonder(..., B_ASMITHS) only once rather than once per 
improvement.

In the eff patch Vasco removes this.  I'm not sure that this is strictly 
necessary (is it possible for this effect to have less-than-city range? 
  Do we care?), but it is prettier.  So this patch pre-emptively does that.

If we're going to remove it we might as well do it now.  On the other 
hand there is an argument for keeping it.  Removing it increases runtime 
by about 0.5% (and this will probably be higher since the query is 
slower in the effects patch).

jason

? client/attribute.o.SJtUD3
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.231
diff -u -r1.231 city.c
--- common/city.c       16 Jul 2004 02:10:34 -0000      1.231
+++ common/city.c       16 Jul 2004 04:12:36 -0000
@@ -583,25 +583,6 @@
 }
 
 /**************************************************************************
-  Caller to pass asmiths = city_affected_by_wonder(pcity, B_ASMITHS)
-**************************************************************************/
-static int improvement_upkeep_asmiths(const struct city *pcity, Impr_Type_id i,
-                                     bool asmiths)
-{
-  if (!improvement_exists(i))
-    return 0;
-  if (is_wonder(i))
-    return 0;
-  if (asmiths && improvement_types[i].upkeep == 1) 
-    return 0;
-  if (government_has_flag(get_gov_pcity(pcity), G_CONVERT_TITHES_TO_MONEY)
-      && (i == B_TEMPLE || i == B_COLOSSEUM || i == B_CATHEDRAL)) {
-    return 0;
-  }
-  return (improvement_types[i].upkeep);
-}
-
-/**************************************************************************
   Calculate the shields for the tile.  If pcity is specified then
   (city_x, city_y) must be valid city coordinates and is_celebrating tells
   whether the city is celebrating.
@@ -1134,11 +1115,10 @@
 *************************************************************************/
 int city_gold_surplus(const struct city *pcity)
 {
-  bool asmiths = city_affected_by_wonder(pcity, B_ASMITHS);
   int cost = 0;
 
   built_impr_iterate(pcity, i) {
-    cost += improvement_upkeep_asmiths(pcity, i, asmiths);
+    cost += improvement_upkeep(pcity, i);
   } built_impr_iterate_end;
 
   unit_list_iterate(pcity->units_supported, punit) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9401) remove improvement_upkeep_asmiths(), Jason Dorje Short <=