[Freeciv-Dev] (PR#11301) gov->output_inc_tile
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=11301 >
This patch changes the gov->xxx_bonus and gov->celeb_xxx_bonus fields
into a pair of arrays. The arrays are renamed as output_inc_tile and
celeb_output_inc_tile. This more or less matches the effect names that
they correspond to, e.g., EFT_FOOD_INC_TILE.
-jason
Index: ai/aihand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aihand.c,v
retrieving revision 1.94
diff -u -r1.94 aihand.c
--- ai/aihand.c 30 Nov 2004 08:37:02 -0000 1.94
+++ ai/aihand.c 2 Dec 2004 10:42:09 -0000
@@ -293,7 +293,9 @@
if (government_has_flag(gov, G_FANATIC_TROOPS)) {
bonus += 3; /* WAG */
}
- val += gov->trade_bonus + gov->shield_bonus + gov->food_bonus;
+ output_type_iterate(o) {
+ val += gov->output_inc_tile[o];
+ } output_type_iterate_end;
val += (val * bonus) / 100;
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.429
diff -u -r1.429 packhand.c
--- client/packhand.c 2 Dec 2004 10:14:53 -0000 1.429
+++ client/packhand.c 2 Dec 2004 10:42:10 -0000
@@ -2428,13 +2428,16 @@
= p->celeb_shields_before_penalty;
gov->celeb_output_before_penalty[O_FOOD] = p->celeb_food_before_penalty;
- gov->trade_bonus = p->trade_bonus;
- gov->shield_bonus = p->shield_bonus;
- gov->food_bonus = p->food_bonus;
-
- gov->celeb_trade_bonus = p->celeb_trade_bonus;
- gov->celeb_shield_bonus = p->celeb_shield_bonus;
- gov->celeb_food_bonus = p->celeb_food_bonus;
+ memset(gov->output_inc_tile, 0, O_COUNT * sizeof(*gov->output_inc_tile));
+ gov->output_inc_tile[O_TRADE] = p->trade_bonus;
+ gov->output_inc_tile[O_SHIELD] = p->shield_bonus;
+ gov->output_inc_tile[O_FOOD] = p->food_bonus;
+
+ memset(gov->celeb_output_inc_tile, 0,
+ O_COUNT * sizeof(*gov->celeb_output_inc_tile));
+ gov->celeb_output_inc_tile[O_TRADE] = p->celeb_trade_bonus;
+ gov->celeb_output_inc_tile[O_SHIELD] = p->celeb_shield_bonus;
+ gov->celeb_output_inc_tile[O_FOOD] = p->celeb_food_bonus;
gov->corruption_level = p->corruption_level;
gov->fixed_corruption_distance = p->fixed_corruption_distance;
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.265
diff -u -r1.265 city.c
--- common/city.c 2 Dec 2004 10:20:30 -0000 1.265
+++ common/city.c 2 Dec 2004 10:42:10 -0000
@@ -602,7 +602,8 @@
/* Government & effect shield bonus/penalty. */
if (s > 0) {
- s += (is_celebrating ? g->celeb_shield_bonus : g->shield_bonus);
+ s += (is_celebrating ? g->celeb_output_inc_tile[O_SHIELD]
+ : g->output_inc_tile[O_SHIELD]);
s += get_city_tile_bonus(pcity, ptile, EFT_PROD_INC_TILE);
}
@@ -705,7 +706,8 @@
t += get_city_tile_bonus(pcity, ptile, EFT_TRADE_ADD_TILE);
if (t > 0) {
- t += (is_celebrating ? g->celeb_trade_bonus : g->trade_bonus);
+ 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);
}
@@ -819,7 +821,8 @@
f += get_city_tile_bonus(pcity, &tile, EFT_FOOD_ADD_TILE);
if (f > 0) {
- f += (is_celebrating ? g->celeb_food_bonus : g->food_bonus);
+ 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);
}
Index: common/government.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/government.h,v
retrieving revision 1.33
diff -u -r1.33 government.h
--- common/government.h 2 Dec 2004 10:14:53 -0000 1.33
+++ common/government.h 2 Dec 2004 10:42:10 -0000
@@ -111,15 +111,11 @@
int output_before_penalty[O_MAX];
int celeb_output_before_penalty[O_MAX];
- /* government production bonuses -- SKi */
- int trade_bonus;
- int shield_bonus;
- int food_bonus;
-
- /* government production bonuses when celebrating */
- int celeb_trade_bonus;
- int celeb_shield_bonus;
- int celeb_food_bonus;
+ /* government production bonuses. These act as an EFT_XXX_INC_TILE
+ * effect. There are separate values for celebrating versus normal
+ * cities. */
+ int output_inc_tile[O_MAX];
+ int celeb_output_inc_tile[O_MAX];
/* corruption modifiers -- SKi */
int corruption_level;
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.206
diff -u -r1.206 ruleset.c
--- server/ruleset.c 2 Dec 2004 10:14:54 -0000 1.206
+++ server/ruleset.c 2 Dec 2004 10:42:11 -0000
@@ -1848,21 +1848,14 @@
g->waste_max_distance_cap
= secfile_lookup_int_default(file, 36, "%s.waste_max_distance_cap",
sec[i]);
- g->trade_bonus
- = secfile_lookup_int(file, "%s.production_trade_bonus", sec[i]);
- g->shield_bonus
- = secfile_lookup_int(file, "%s.production_shield_bonus", sec[i]);
- g->food_bonus
- = secfile_lookup_int(file, "%s.production_food_bonus", sec[i]);
-
- g->celeb_trade_bonus
- = secfile_lookup_int(file, "%s.production_trade_bonus,1", sec[i]);
- g->celeb_shield_bonus
- = secfile_lookup_int(file, "%s.production_shield_bonus,1", sec[i]);
- g->celeb_food_bonus
- = secfile_lookup_int(file, "%s.production_food_bonus,1", sec[i]);
-
output_type_iterate(o) {
+ g->output_inc_tile[o]
+ = secfile_lookup_int_default(file, 0, "%s.production_%s_bonus",
+ sec[i], get_output_identifier(o));
+ g->celeb_output_inc_tile[o]
+ = secfile_lookup_int_default(file, 0, "%s.production_%s_bonus,1",
+ sec[i], get_output_identifier(o));
+
g->output_before_penalty[o]
= secfile_lookup_int_default(file, FC_INFINITY,
"%s.production_%s_penalty", sec[i],
@@ -3035,13 +3028,13 @@
= g->celeb_output_before_penalty[O_SHIELD];
gov.celeb_food_before_penalty = g->celeb_output_before_penalty[O_FOOD];
- gov.trade_bonus = g->trade_bonus;
- gov.shield_bonus = g->shield_bonus;
- gov.food_bonus = g->food_bonus;
-
- gov.celeb_trade_bonus = g->celeb_trade_bonus;
- gov.celeb_shield_bonus = g->celeb_shield_bonus;
- gov.celeb_food_bonus = g->celeb_food_bonus;
+ gov.trade_bonus = g->output_inc_tile[O_TRADE];
+ gov.shield_bonus = g->output_inc_tile[O_SHIELD];
+ gov.food_bonus = g->output_inc_tile[O_FOOD];
+
+ gov.celeb_trade_bonus = g->celeb_output_inc_tile[O_TRADE];
+ gov.celeb_shield_bonus = g->celeb_output_inc_tile[O_SHIELD];
+ gov.celeb_food_bonus = g->celeb_output_inc_tile[O_FOOD];
gov.corruption_level = g->corruption_level;
gov.fixed_corruption_distance = g->fixed_corruption_distance;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#11301) gov->output_inc_tile,
Jason Short <=
|
|