Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11300) bad use of effects in base_get_xxx_tile?
Home

[Freeciv-Dev] (PR#11300) bad use of effects in base_get_xxx_tile?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11300) bad use of effects in base_get_xxx_tile?
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 9 Dec 2004 11:15:00 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Thu Dec 02 10:39:08 2004]:
> 
> In the three base_get_xxx_tile functions there are the following lines:
> 
>      s += get_city_tile_bonus(pcity, ptile, EFT_PROD_ADD_TILE);
>        s += get_city_tile_bonus(pcity, ptile, EFT_PROD_INC_TILE);
>      s += (s * get_city_tile_bonus(pcity, ptile, EFT_PROD_PER_TILE)) /
100;
> 
> 
>      t += get_city_tile_bonus(pcity, ptile, EFT_TRADE_ADD_TILE);
>        t += get_city_bonus(pcity, EFT_TRADE_INC_TILE);
>      t += (t * get_city_tile_bonus(pcity, ptile, EFT_TRADE_PER_TILE))
/ 100;
> 
> 
>      f += get_city_tile_bonus(pcity, &tile, EFT_FOOD_ADD_TILE);
>        f += get_city_bonus(pcity, EFT_FOOD_INC_TILE);
>      f += (f * get_city_tile_bonus(pcity, &tile, EFT_FOOD_PER_TILE) /
100);
> 
> It seems obvious enough that the get_city_bonus() checks are wrong.  All 
> these checks should be get_city_tile_bonus().  This means 
> EFT_FOOD_INC_TILE and EFT_TRADE_INC_TILE with a terrain or special req 
> won't work.

Here's a patch.

Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.276
diff -u -r1.276 city.c
--- common/city.c       9 Dec 2004 18:29:59 -0000       1.276
+++ common/city.c       9 Dec 2004 19:14:34 -0000
@@ -709,7 +709,7 @@
     if (t > 0) {
       t += (is_celebrating ? g->celeb_output_inc_tile[O_TRADE]
            : g->output_inc_tile[O_TRADE]);
-      t += get_city_bonus(pcity, EFT_TRADE_INC_TILE);
+      t += get_city_tile_bonus(pcity, ptile, EFT_TRADE_INC_TILE);
     }
 
     t += (t * get_city_tile_bonus(pcity, ptile, EFT_TRADE_PER_TILE)) / 100;
@@ -824,7 +824,7 @@
     if (f > 0) {
       f += (is_celebrating ? g->celeb_output_inc_tile[O_FOOD]
            : g->output_inc_tile[O_FOOD]);
-      f += get_city_bonus(pcity, EFT_FOOD_INC_TILE);
+      f += get_city_tile_bonus(pcity, &tile, EFT_FOOD_INC_TILE);
     }
 
     f += (f * get_city_tile_bonus(pcity, &tile, EFT_FOOD_PER_TILE) / 100);

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