Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12904) remove get_tile_output_base
Home

[Freeciv-Dev] (PR#12904) remove get_tile_output_base

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12904) remove get_tile_output_base
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Apr 2005 20:12:30 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch simply removes get_tile_output_base.  There is one caller
which now does this calculation itself.  It is highly unlikely that any
other callers will ever be wanted.

-jason

Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.332
diff -u -r1.332 city.c
--- common/city.c       23 Apr 2005 17:40:26 -0000      1.332
+++ common/city.c       27 Apr 2005 03:11:31 -0000
@@ -721,13 +721,21 @@
 {
   const struct tile_type *ptype = get_tile_type(ptile->terrain);
   struct tile tile;
-  int prod = get_tile_output_base(ptile, otype);
+  int prod;
   const bool auto_water = (pcity && is_city_center(city_x, city_y)
                           && ptile->terrain == ptype->irrigation_result
                           && terrain_control.may_irrigate);
 
   assert(otype >= 0 && otype < O_LAST);
 
+  if (tile_has_special(ptile, S_SPECIAL_1)) {
+    prod = tile_types[ptile->terrain].special[0].output[otype];
+  } else if (tile_has_special(ptile, S_SPECIAL_2)) {
+    prod = tile_types[ptile->terrain].special[1].output[otype];
+  } else {
+    prod = tile_types[ptile->terrain].output[otype];
+  }
+
   /* create dummy tile which has the city center bonuses. */
   tile.terrain = tile_get_terrain(ptile);
   tile.special = tile_get_special(ptile);
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.219
diff -u -r1.219 map.c
--- common/map.c        27 Apr 2005 02:48:00 -0000      1.219
+++ common/map.c        27 Apr 2005 03:11:31 -0000
@@ -639,21 +639,6 @@
   return FALSE;
 }
 
-/****************************************************************************
-  Return the output of this type provided by the tile.  This includes base
-  terrain plus S_SPECIAL_1 and S_SPECIAL_2, but not any other specials
-  (river/road/irrigation/etc).
-****************************************************************************/
-int get_tile_output_base(const struct tile *ptile, Output_type_id output)
-{
-  if (tile_has_special(ptile, S_SPECIAL_1)) 
-    return tile_types[ptile->terrain].special[0].output[output];
-  else if (tile_has_special(ptile, S_SPECIAL_2))
-    return tile_types[ptile->terrain].special[1].output[output];
-  else
-    return tile_types[ptile->terrain].output[output];
-}
-
 /***************************************************************
   Return a (static) string with special(s) name(s);
   eg: "Mine"
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.241
diff -u -r1.241 map.h
--- common/map.h        27 Apr 2005 02:48:00 -0000      1.241
+++ common/map.h        27 Apr 2005 03:11:31 -0000
@@ -279,7 +279,6 @@
 int map_move_cost_ai(const struct tile *tile0, const struct tile *tile1);
 bool is_safe_ocean(const struct tile *ptile);
 bool is_cardinally_adj_to_ocean(const struct tile *ptile);
-int get_tile_output_base(const struct tile *ptile, Output_type_id output);
 enum tile_special_type get_tile_infrastructure_set(const struct tile *ptile);
 const char *map_get_infrastructure_text(enum tile_special_type spe);
 enum tile_special_type map_get_infrastructure_prerequisite(enum 
tile_special_type spe);

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