[Freeciv-Dev] (PR#11302) remove city_xxx_bonus()
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=11302 >
This patch removes the city_xxx_bonus() functions from cityhand.[ch].
These functions are just accessors for the pcity->bonus[] array. While
having accessors is nice, they are only used in one place in settlers.c
and are really easy to confuse with the get_city_xxx_bonus() functions.
So I think it's fine just to remove them.
Alternately we can make them into full-fledged accessor functions by
moving them into city.[ch] and adding lots more users.
jason
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.283
diff -u -r1.283 citytools.c
--- server/citytools.c 2 Dec 2004 10:20:30 -0000 1.283
+++ server/citytools.c 2 Dec 2004 10:53:19 -0000
@@ -493,42 +493,6 @@
return 0;
}
-/**************************************************************************
- Return the cached shield bonus rate. Don't confuse this with
- get_city_shield_bonus which recomputes the value from scratch.
-**************************************************************************/
-int city_shield_bonus(struct city *pcity)
-{
- return pcity->bonus[O_SHIELD];
-}
-
-/**************************************************************************
- Return the cached luxury bonus rate. Don't confuse this with
- get_city_luxury_bonus which recomputes the value from scratch.
-**************************************************************************/
-int city_luxury_bonus(struct city *pcity)
-{
- return pcity->bonus[O_LUXURY];
-}
-
-/**************************************************************************
- Return the cached tax bonus rate. Don't confuse this with
- get_city_tax_bonus which recomputes the value from scratch.
-**************************************************************************/
-int city_tax_bonus(struct city *pcity)
-{
- return pcity->bonus[O_GOLD];
-}
-
-/**************************************************************************
- Return the cached science bonus rate. Don't confuse this with
- get_city_science_bonus which recomputes the value from scratch.
-**************************************************************************/
-int city_science_bonus(struct city *pcity)
-{
- return pcity->bonus[O_SCIENCE];
-}
-
/*********************************************************************
Note: the old unit is not wiped here.
***********************************************************************/
Index: server/citytools.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.h,v
retrieving revision 1.58
diff -u -r1.58 citytools.h
--- server/citytools.h 29 Sep 2004 02:24:23 -0000 1.58
+++ server/citytools.h 2 Dec 2004 10:53:19 -0000
@@ -34,10 +34,6 @@
struct city *find_city_wonder(Impr_Type_id id);
int build_points_left(struct city *pcity);
int do_make_unit_veteran(struct city *pcity, Unit_Type_id id);
-int city_shield_bonus(struct city *pcity);
-int city_luxury_bonus(struct city *pcity);
-int city_science_bonus(struct city *pcity);
-int city_tax_bonus(struct city *pcity);
void transfer_city_units(struct player *pplayer, struct player *pvictim,
struct unit_list *units, struct city *pcity,
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.212
diff -u -r1.212 settlers.c
--- server/settlers.c 22 Nov 2004 19:14:42 -0000 1.212
+++ server/settlers.c 2 Dec 2004 10:53:19 -0000
@@ -243,13 +243,13 @@
if (prodneed > 0) {
shield_value += 9 * (MIN(shield_value, prodneed));
}
- shield_value *= SHIELD_WEIGHTING * city_shield_bonus(pcity);
+ shield_value *= SHIELD_WEIGHTING * pcity->bonus[O_SHIELD];
shield_value /= 100;
trade_value = (city_get_trade_tile(x, y, pcity) * pcity->ai.trade_want
- * (city_tax_bonus(pcity) * plr->economic.tax
- + city_luxury_bonus(pcity) * plr->economic.luxury
- + city_science_bonus(pcity) * plr->economic.science)) / 10000;
+ * (pcity->bonus[O_GOLD] * plr->economic.tax
+ + pcity->bonus[O_LUXURY] * plr->economic.luxury
+ + pcity->bonus[O_SCIENCE] * plr->economic.science)) / 10000;
return food_value + shield_value + trade_value;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#11302) remove city_xxx_bonus(),
Jason Short <=
|
|