[Freeciv-Dev] (PR#12504) RFC: use of effects for terrain/special data
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12504 >
Attached is a preliminary/prototype patch to replace all terrain output
data with effects.
In place of the road_trade_incr, pollution_penalty_pct,
output_before_penalty values in terrain types and governments, we have a
set of 12 effects types: three passes of 4 different effect types.
ADD: adds the output on
INC: adds the output on, if output > 0
PER: adds on a percentage
PENALTY: a -1 if the output is greater than this amount
running three passes of each of these should be sufficient to reproduce
all the current behavior.
I have some questions whether this is the best way to do it however.
Namely:
1. It will be slower. Probably 10x slower, because it has to loop over
the effects for the base outputs for every terrain rather than doing a
switch or single array lookup. However this may not be an issue since
this code isn't _that_ critical.
2. Rulesets will be a lot more verbose. Instead of
[terrain_plains]
food_output = 1
shield_output = 1
trade_output = 0
special_1_food_output = 3
special_1_shield_output = 1
special_1_trade_output = 0
special_2_food_output = 1
special_2_shield_output = 2
special_2_trade_output = 0
we will have
[effect_plains_food]
type = "Food_Add_1"
value = 1
reqs = { "type", "name"
"terrain", "plains"
"outputtype", "food"
}
[effect_plains_shield]
type = "Shield_Add_1"
value = 1
reqs = { "type", "name"
"terrain", "plains"
"outputtype", "shields"
}
[effect_wheat_food]
type = "Food_Add_1"
value = 2
reqs = { "type", "name"
"terrain", "plains"
"outputtype", "food"
}
[effect_buffalo_shields]
type = "Shield_Add_1"
value = 1
reqs = { "type", "name"
"terrain", "plains"
"outputtype", "shields"
}
The patch is incomplete. None of the rulesets are updated. Also there
is no helptext support yet.
-jason
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.225
diff -u -r1.225 aicity.c
--- ai/aicity.c 20 May 2005 16:07:32 -0000 1.225
+++ ai/aicity.c 21 May 2005 00:38:03 -0000
@@ -320,9 +320,18 @@
case EFT_POLLU_PROD_PCT:
case EFT_OUTPUT_BONUS:
case EFT_OUTPUT_BONUS_2:
- case EFT_OUTPUT_ADD_TILE:
- case EFT_OUTPUT_INC_TILE:
- case EFT_OUTPUT_PER_TILE:
+ case EFT_OUTPUT_ADD_TILE_1:
+ case EFT_OUTPUT_INC_TILE_1:
+ case EFT_OUTPUT_PER_TILE_1:
+ case EFT_OUTPUT_PENALTY_TILE_1:
+ case EFT_OUTPUT_ADD_TILE_2:
+ case EFT_OUTPUT_INC_TILE_2:
+ case EFT_OUTPUT_PER_TILE_2:
+ case EFT_OUTPUT_PENALTY_TILE_2:
+ case EFT_OUTPUT_ADD_TILE_3:
+ case EFT_OUTPUT_INC_TILE_3:
+ case EFT_OUTPUT_PER_TILE_3:
+ case EFT_OUTPUT_PENALTY_TILE_3:
case EFT_OUTPUT_WASTE_PCT:
case EFT_SPECIALIST_OUTPUT:
break;
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.69
diff -u -r1.69 aidata.c
--- ai/aidata.c 20 May 2005 16:07:32 -0000 1.69
+++ ai/aidata.c 21 May 2005 00:38:04 -0000
@@ -294,9 +294,18 @@
case EFT_POLLU_PROD_PCT:
case EFT_OUTPUT_BONUS:
case EFT_OUTPUT_BONUS_2:
- case EFT_OUTPUT_ADD_TILE:
- case EFT_OUTPUT_PER_TILE:
- case EFT_OUTPUT_INC_TILE:
+ case EFT_OUTPUT_ADD_TILE_1:
+ case EFT_OUTPUT_INC_TILE_1:
+ case EFT_OUTPUT_PER_TILE_1:
+ case EFT_OUTPUT_PENALTY_TILE_1:
+ case EFT_OUTPUT_ADD_TILE_2:
+ case EFT_OUTPUT_INC_TILE_2:
+ case EFT_OUTPUT_PER_TILE_2:
+ case EFT_OUTPUT_PENALTY_TILE_2:
+ case EFT_OUTPUT_ADD_TILE_3:
+ case EFT_OUTPUT_INC_TILE_3:
+ case EFT_OUTPUT_PER_TILE_3:
+ case EFT_OUTPUT_PENALTY_TILE_3:
case EFT_OUTPUT_WASTE_PCT:
case EFT_UPKEEP_FREE:
requirement_list_iterate(peffect->reqs, preq) {
Index: ai/aihand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aihand.c,v
retrieving revision 1.117
diff -u -r1.117 aihand.c
--- ai/aihand.c 14 May 2005 15:38:49 -0000 1.117
+++ ai/aihand.c 21 May 2005 00:38:04 -0000
@@ -320,9 +320,6 @@
bonus += get_player_bonus(pplayer, EFT_INSPIRE_PARTISANS) ? 3 : 0;
bonus += get_player_bonus(pplayer, EFT_RAPTURE_GROW) ? 2 : 0;
bonus += get_player_bonus(pplayer, EFT_FANATICS) ? 3 : 0;
- output_type_iterate(o) {
- val += gov->output_inc_tile[o];
- } output_type_iterate_end;
val += (val * bonus) / 100;
Index: client/helpdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/helpdata.c,v
retrieving revision 1.116
diff -u -r1.116 helpdata.c
--- client/helpdata.c 11 May 2005 14:11:20 -0000 1.116
+++ client/helpdata.c 21 May 2005 00:38:04 -0000
@@ -1360,6 +1360,7 @@
}
} output_type_iterate_end;
output_type_iterate(ot) {
+#if 0
if (gov->output_before_penalty[ot] > 0
&& gov->output_before_penalty[ot]
== gov->celeb_output_before_penalty[ot]) {
@@ -1373,8 +1374,10 @@
"suffer a -1 penalty when not celebrating.\n"),
gov->output_before_penalty[ot], get_output_name(ot));
}
+#endif
} output_type_iterate_end;
output_type_iterate(ot) {
+#if 0
if (gov->celeb_output_before_penalty[ot] > 0
&& gov->celeb_output_before_penalty[ot]
!= gov->output_before_penalty[ot]) {
@@ -1383,8 +1386,10 @@
"than %d %s will suffer a -1 penalty when celebrating.\n"),
gov->celeb_output_before_penalty[ot], get_output_name(ot));
}
+#endif
} output_type_iterate_end;
output_type_iterate(ot) {
+#if 0
if (gov->output_inc_tile[ot] > 0
&& gov->output_inc_tile[ot] == gov->celeb_output_inc_tile[ot]) {
sprintf(buf + strlen(buf),
@@ -1398,8 +1403,10 @@
get_output_name(ot), gov->output_inc_tile[ot],
get_output_name(ot));
}
+#endif
} output_type_iterate_end;
output_type_iterate(ot) {
+#if 0
if (gov->celeb_output_inc_tile[ot] > 0
&& gov->celeb_output_inc_tile[ot] != gov->output_inc_tile[ot]) {
sprintf(buf + strlen(buf),
@@ -1408,6 +1415,7 @@
get_output_name(ot), gov->celeb_output_inc_tile[ot],
get_output_name(ot));
}
+#endif
} output_type_iterate_end;
output_type_iterate(ot) {
if (gov->waste[ot].level > 0) {
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.516
diff -u -r1.516 packhand.c
--- client/packhand.c 11 May 2005 20:03:07 -0000 1.516
+++ client/packhand.c 21 May 2005 00:38:05 -0000
@@ -2210,11 +2210,6 @@
gov->free_upkeep[o] = p->free_upkeep[o];
gov->unit_upkeep_factor[o] = p->unit_upkeep_factor[o];
- gov->output_before_penalty[o] = p->output_before_penalty[o];
- gov->celeb_output_before_penalty[o] = p->celeb_output_before_penalty[o];
- gov->output_inc_tile[o] = p->output_inc_tile[o];
- gov->celeb_output_inc_tile[o] = p->celeb_output_inc_tile[o];
-
gov->waste[o].level = p->waste_level[o];
gov->waste[o].fixed_distance = p->fixed_waste_distance[o];
gov->waste[o].distance_factor = p->waste_distance_factor[o];
@@ -2283,12 +2278,6 @@
t->movement_cost = p->movement_cost;
t->defense_bonus = p->defense_bonus;
- output_type_iterate(o) {
- t->output[o] = p->output[o];
- t->special[0].output[o] = p->output_special_1[o];
- t->special[1].output[o] = p->output_special_2[o];
- } output_type_iterate_end;
-
sz_strlcpy(t->special[0].name_orig, p->special_1_name);
t->special[0].name = t->special[0].name_orig;
@@ -2302,12 +2291,9 @@
sz_strlcpy(t->special[1].graphic_alt, p->graphic_alt_special_2);
t->road_time = p->road_time;
- t->road_trade_incr = p->road_trade_incr;
t->irrigation_result = p->irrigation_result;
- t->irrigation_food_incr = p->irrigation_food_incr;
t->irrigation_time = p->irrigation_time;
t->mining_result = p->mining_result;
- t->mining_shield_incr = p->mining_shield_incr;
t->mining_time = p->mining_time;
t->transform_result = p->transform_result;
t->transform_time = p->transform_time;
Index: client/gui-gtk-2.0/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/helpdlg.c,v
retrieving revision 1.50
diff -u -r1.50 helpdlg.c
--- client/gui-gtk-2.0/helpdlg.c 14 May 2005 22:49:02 -0000 1.50
+++ client/gui-gtk-2.0/helpdlg.c 21 May 2005 00:38:05 -0000
@@ -1027,21 +1027,25 @@
tile_types[i].defense_bonus%10);
gtk_label_set_text(GTK_LABEL(help_tlabel[0][1]), buf);
+#if 0
sprintf(buf, "%d/%d/%d",
tile_types[i].output[O_FOOD],
tile_types[i].output[O_SHIELD],
tile_types[i].output[O_TRADE]);
gtk_label_set_text(GTK_LABEL(help_tlabel[0][4]), buf);
+#endif
if (*(tile_types[i].special[0].name)) {
sprintf(buf, _("%s F/R/T:"),
tile_types[i].special[0].name);
gtk_label_set_text(GTK_LABEL(help_tlabel[1][0]), buf);
+#if 0
sprintf(buf, "%d/%d/%d",
tile_types[i].special[0].output[O_FOOD],
tile_types[i].special[0].output[O_SHIELD],
tile_types[i].special[0].output[O_TRADE]);
gtk_label_set_text(GTK_LABEL(help_tlabel[1][1]), buf);
+#endif
} else {
gtk_label_set_text(GTK_LABEL(help_tlabel[1][0]), "");
gtk_label_set_text(GTK_LABEL(help_tlabel[1][1]), "");
@@ -1051,16 +1055,19 @@
sprintf(buf, _("%s F/R/T:"),
tile_types[i].special[1].name);
gtk_label_set_text(GTK_LABEL(help_tlabel[1][3]), buf);
+#if 0
sprintf(buf, "%d/%d/%d",
tile_types[i].special[1].output[O_FOOD],
tile_types[i].special[1].output[O_SHIELD],
tile_types[i].special[1].output[O_TRADE]);
gtk_label_set_text(GTK_LABEL(help_tlabel[1][4]), buf);
+#endif
} else {
gtk_label_set_text(GTK_LABEL(help_tlabel[1][3]), "");
gtk_label_set_text(GTK_LABEL(help_tlabel[1][4]), "");
}
+#if 0
if (tile_types[i].road_trade_incr > 0) {
sprintf(buf, _("+%d Trade / %d"),
tile_types[i].road_trade_incr,
@@ -1072,8 +1079,11 @@
strcpy(buf, _("n/a"));
}
gtk_label_set_text(GTK_LABEL(help_tlabel[2][1]), buf);
+#endif
strcpy(buf, _("n/a"));
+
+#if 0
if (tile_types[i].irrigation_result == i) {
if (tile_types[i].irrigation_food_incr > 0) {
sprintf(buf, _("+%d Food / %d"),
@@ -1085,9 +1095,11 @@
tile_types[tile_types[i].irrigation_result].terrain_name,
tile_types[i].irrigation_time);
}
+#endif
gtk_label_set_text(GTK_LABEL(help_tlabel[2][4]), buf);
strcpy(buf, _("n/a"));
+#if 0
if (tile_types[i].mining_result == i) {
if (tile_types[i].mining_shield_incr > 0) {
sprintf(buf, _("+%d Res. / %d"),
@@ -1099,6 +1111,7 @@
tile_types[tile_types[i].mining_result].terrain_name,
tile_types[i].mining_time);
}
+#endif
gtk_label_set_text(GTK_LABEL(help_tlabel[3][1]), buf);
if (tile_types[i].transform_result != T_NONE) {
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.347
diff -u -r1.347 city.c
--- common/city.c 14 May 2005 14:45:23 -0000 1.347
+++ common/city.c 21 May 2005 00:38:06 -0000
@@ -574,27 +574,16 @@
Output_type_id otype)
{
const struct tile_type *ptype = get_tile_type(ptile->terrain);
- struct tile tile;
- int prod;
+ struct tile tile = *ptile;
+ int prod = 0;
const bool auto_water = (pcity && is_city_center(city_x, city_y)
&& ptile->terrain == ptype->irrigation_result
&& terrain_control.may_irrigate);
const struct output_type *output = &output_types[otype];
+ int priority;
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);
-
if (auto_water) {
/* The center tile is auto-irrigated. */
tile.special |= S_IRRIGATION;
@@ -604,70 +593,38 @@
}
}
- switch (otype) {
- case O_SHIELD:
- if (contains_special(tile.special, S_MINE)) {
- prod += ptype->mining_shield_incr;
- }
- break;
- case O_FOOD:
- if (contains_special(tile.special, S_IRRIGATION)) {
- prod += ptype->irrigation_food_incr;
- }
- break;
- case O_TRADE:
- if (contains_special(tile.special, S_RIVER) && !is_ocean(tile.terrain)) {
- prod += terrain_control.river_trade_incr;
- }
- if (contains_special(tile.special, S_ROAD)) {
- prod += ptype->road_trade_incr;
- }
- break;
- case O_GOLD:
- case O_SCIENCE:
- case O_LUXURY:
- case O_LAST:
- break;
- }
-
- if (contains_special(tile.special, S_RAILROAD)) {
- prod += (prod * terrain_control.rail_tile_bonus[otype]) / 100;
- }
-
- if (pcity) {
- struct government *g = get_gov_pcity(pcity);
- int before_penalty = (is_celebrating
- ? g->celeb_output_before_penalty[otype]
- : g->output_before_penalty[otype]);
-
- prod += get_city_tile_output_bonus(pcity, ptile, output,
- EFT_OUTPUT_ADD_TILE);
+ for (priority = 0; priority < 3; priority++) {
+ enum effect_type adds[3] = {EFT_OUTPUT_ADD_TILE_1,
+ EFT_OUTPUT_ADD_TILE_2,
+ EFT_OUTPUT_ADD_TILE_3};
+ enum effect_type incs[3] = {EFT_OUTPUT_INC_TILE_1,
+ EFT_OUTPUT_INC_TILE_2,
+ EFT_OUTPUT_INC_TILE_3};
+ enum effect_type pers[3] = {EFT_OUTPUT_PER_TILE_1,
+ EFT_OUTPUT_PER_TILE_2,
+ EFT_OUTPUT_PER_TILE_3};
+ enum effect_type penalties[3] = {EFT_OUTPUT_PENALTY_TILE_1,
+ EFT_OUTPUT_PENALTY_TILE_2,
+ EFT_OUTPUT_PENALTY_TILE_3};
+ int add = get_city_tile_output_bonus(pcity, ptile, output,
+ adds[priority]);
+ int inc = get_city_tile_output_bonus(pcity, ptile, output,
+ incs[priority]);
+ int per = get_city_tile_output_bonus(pcity, ptile, output,
+ pers[priority]);
+ int penalty = get_city_tile_output_bonus(pcity, ptile, output,
+ penalties[priority]);
- /* Government & effect bonus/penalty. */
+ prod += add;
if (prod > 0) {
- prod += (is_celebrating
- ? g->celeb_output_inc_tile[otype]
- : g->output_inc_tile[otype]);
- prod += get_city_tile_output_bonus(pcity, ptile, output,
- EFT_OUTPUT_INC_TILE);
+ prod += inc;
}
-
- prod += (prod * get_city_tile_output_bonus(pcity, ptile, output,
- EFT_OUTPUT_PER_TILE)) / 100;
-
- if (before_penalty > 0 && prod > before_penalty) {
+ prod += (prod * per) / 100;
+ if (penalty > 0 && prod > penalty) {
prod--;
}
}
- if (contains_special(tile.special, S_POLLUTION)) {
- prod -= (prod * terrain_control.pollution_tile_penalty[otype]) / 100;
- }
-
- if (contains_special(tile.special, S_FALLOUT)) {
- prod -= (prod * terrain_control.fallout_tile_penalty[otype]) / 100;
- }
-
if (pcity && is_city_center(city_x, city_y)) {
prod = MAX(prod, game.info.min_city_center_output[otype]);
}
Index: common/effects.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.c,v
retrieving revision 1.44
diff -u -r1.44 effects.c
--- common/effects.c 14 May 2005 22:35:28 -0000 1.44
+++ common/effects.c 21 May 2005 00:38:06 -0000
@@ -46,9 +46,18 @@
"Specialist_Output",
"Output_Bonus",
"Output_Bonus_2",
- "Output_Add_Tile",
- "Output_Inc_Tile",
- "Output_Per_Tile",
+ "Output_Add_Tile_1",
+ "Output_Inc_Tile_1",
+ "Output_Per_Tile_1",
+ "Output_Penalty_Tile_1",
+ "Output_Add_Tile_2",
+ "Output_Inc_Tile_2",
+ "Output_Per_Tile_2",
+ "Output_Penalty_Tile_2",
+ "Output_Add_Tile_3",
+ "Output_Inc_Tile_3",
+ "Output_Per_Tile_3",
+ "Output_Penalty_Tile_3",
"Output_Waste_Pct",
"Force_Content",
/* TODO: "Force_Content_Pct", */
Index: common/effects.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.h,v
retrieving revision 1.26
diff -u -r1.26 effects.h
--- common/effects.h 10 May 2005 19:08:54 -0000 1.26
+++ common/effects.h 21 May 2005 00:38:06 -0000
@@ -33,9 +33,18 @@
EFT_SPECIALIST_OUTPUT,
EFT_OUTPUT_BONUS,
EFT_OUTPUT_BONUS_2,
- EFT_OUTPUT_ADD_TILE,
- EFT_OUTPUT_INC_TILE,
- EFT_OUTPUT_PER_TILE,
+ EFT_OUTPUT_ADD_TILE_1,
+ EFT_OUTPUT_INC_TILE_1,
+ EFT_OUTPUT_PER_TILE_1,
+ EFT_OUTPUT_PENALTY_TILE_1,
+ EFT_OUTPUT_ADD_TILE_2,
+ EFT_OUTPUT_INC_TILE_2,
+ EFT_OUTPUT_PER_TILE_2,
+ EFT_OUTPUT_PENALTY_TILE_2,
+ EFT_OUTPUT_ADD_TILE_3,
+ EFT_OUTPUT_INC_TILE_3,
+ EFT_OUTPUT_PER_TILE_3,
+ EFT_OUTPUT_PENALTY_TILE_3,
EFT_OUTPUT_WASTE_PCT,
EFT_FORCE_CONTENT,
/* TODO: EFT_FORCE_CONTENT_PCT, */
Index: common/government.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/government.h,v
retrieving revision 1.46
diff -u -r1.46 government.h
--- common/government.h 11 May 2005 14:11:21 -0000 1.46
+++ common/government.h 21 May 2005 00:38:06 -0000
@@ -63,16 +63,6 @@
/* base cost that a city does not have to "pay" for */
int free_happy;
int free_upkeep[O_MAX];
-
- /* government production penalties (when celebrating and when not) */
- int output_before_penalty[O_MAX];
- int celeb_output_before_penalty[O_MAX];
-
- /* 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];
/* waste/corruption modifiers - see governments.ruleset for more detail */
struct gov_waste {
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.125
diff -u -r1.125 packets.def
--- common/packets.def 11 May 2005 20:03:08 -0000 1.125
+++ common/packets.def 21 May 2005 00:38:06 -0000
@@ -1093,11 +1093,6 @@
UINT8 free_happy;
UINT8 free_upkeep[O_MAX];
- UINT8 output_before_penalty[O_MAX];
- UINT8 celeb_output_before_penalty[O_MAX];
- UINT8 output_inc_tile[O_MAX];
- UINT8 celeb_output_inc_tile[O_MAX];
-
UINT16 waste_level[O_MAX];
UINT8 fixed_waste_distance[O_MAX];
UINT8 waste_distance_factor[O_MAX];
@@ -1129,10 +1124,6 @@
UINT16 fortress_defense_bonus; /* % added to defense if fortress */
UINT16 road_superhighway_trade_bonus; # % added to trade if road/s-highway
- UINT16 rail_tile_bonus[O_MAX]; /* % added to output if railroad */
- UINT16 farmland_supermarket_food_bonus;# % added to food if farm/s-market
- UINT8 pollution_tile_penalty[O_MAX]; /* % taken from output if polluted */
- UINT8 fallout_tile_penalty[O_MAX]; /* % taken from output if polluted */
end
PACKET_RULESET_NATION=102;sc,lsend
@@ -1200,15 +1191,11 @@
UINT8 movement_cost;
UINT8 defense_bonus;
- UINT8 output[O_MAX];
-
STRING special_1_name[MAX_LEN_NAME];
- UINT8 output_special_1[O_MAX];
STRING graphic_str_special_1[MAX_LEN_NAME];
STRING graphic_alt_special_1[MAX_LEN_NAME];
STRING special_2_name[MAX_LEN_NAME];
- UINT8 output_special_2[O_MAX];
STRING graphic_str_special_2[MAX_LEN_NAME];
STRING graphic_alt_special_2[MAX_LEN_NAME];
Index: common/terrain.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.h,v
retrieving revision 1.34
diff -u -r1.34 terrain.h
--- common/terrain.h 5 May 2005 18:32:52 -0000 1.34
+++ common/terrain.h 21 May 2005 00:38:06 -0000
@@ -131,26 +131,20 @@
int movement_cost;
int defense_bonus; /* Bonus multiplier as a per-deca (20 means 2x) */
- int output[O_MAX];
-
#define MAX_NUM_SPECIALS 2
struct {
const char *name; /* Translated string - doesn't need freeing. */
char name_orig[MAX_LEN_NAME];
- int output[O_MAX];
char graphic_str[MAX_LEN_NAME];
char graphic_alt[MAX_LEN_NAME];
} special[MAX_NUM_SPECIALS];
- int road_trade_incr;
int road_time;
Terrain_type_id irrigation_result;
- int irrigation_food_incr;
int irrigation_time;
Terrain_type_id mining_result;
- int mining_shield_incr;
int mining_time;
Terrain_type_id transform_result;
Index: manual/civmanual.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/manual/civmanual.c,v
retrieving revision 1.12
diff -u -r1.12 civmanual.c
--- manual/civmanual.c 11 May 2005 14:11:21 -0000 1.12
+++ manual/civmanual.c 21 May 2005 00:38:06 -0000
@@ -237,24 +237,30 @@
fprintf(doc, "<tr><td>%s%s%s %s</td>", IMAGE_BEGIN,
ptype->graphic_str,
IMAGE_END, get_terrain_name(id));
+#if 0
fprintf(doc, "<td>%d / %d / %d</td>",
ptype->output[O_FOOD], ptype->output[O_SHIELD],
ptype->output[O_TRADE]);
+#endif
for (s = 0; s < MAX_NUM_SPECIALS; s++) {
fprintf(doc, "<td>%s%s%s %s</td>", IMAGE_BEGIN,
ptype->special[s].graphic_str, IMAGE_END,
ptype->special[s].name);
+#if 0
fprintf(doc, "<td>%d / %d / %d</td>",
ptype->special[s].output[O_FOOD],
ptype->special[s].output[O_SHIELD],
ptype->special[s].output[O_TRADE]);
+#endif
}
fprintf(doc, "<td>%d</td>\n", ptype->movement_cost);
+#if 0
fprintf(doc, "<td>%d0%%</td><td>%d</td><td>%d</td><td>%d</td>\n",
ptype->defense_bonus, ptype->road_trade_incr,
ptype->irrigation_food_incr, ptype->mining_shield_incr);
+#endif
fprintf(doc, "<td>%s</td></tr>\n\n",
get_terrain_name(ptype->transform_result));
} terrain_type_iterate_end;
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.265
diff -u -r1.265 ruleset.c
--- server/ruleset.c 14 May 2005 22:33:42 -0000 1.265
+++ server/ruleset.c 21 May 2005 00:38:07 -0000
@@ -1430,21 +1430,6 @@
terrain_control.road_superhighway_trade_bonus =
secfile_lookup_int_default(file, 50,
"parameters.road_superhighway_trade_bonus");
- output_type_iterate(o) {
- terrain_control.rail_tile_bonus[o] =
- secfile_lookup_int_default(file, 0, "parameters.rail_%s_bonus",
- get_output_identifier(o));
- terrain_control.pollution_tile_penalty[o]
- = secfile_lookup_int_default(file, 50,
- "parameters.pollution_%s_penalty",
- get_output_identifier(o));
- terrain_control.fallout_tile_penalty[o]
- = secfile_lookup_int_default(file, 50,
- "parameters.fallout_%s_penalty",
- get_output_identifier(o));
- } output_type_iterate_end;
- terrain_control.farmland_supermarket_food_bonus =
- secfile_lookup_int_default(file, 50,
"parameters.farmland_supermarket_food_bonus");
sec = secfile_get_secnames_prefix(file, "terrain_", &nval);
@@ -1479,11 +1464,6 @@
t->movement_cost = secfile_lookup_int(file, "%s.movement_cost", sec[i]);
t->defense_bonus = secfile_lookup_int(file, "%s.defense_bonus", sec[i]);
- output_type_iterate(o) {
- t->output[o] = secfile_lookup_int_default(file, 0, "%s.%s", sec[i],
- get_output_identifier(o));
- } output_type_iterate_end;
-
for (j = 0; j < MAX_NUM_SPECIALS; j++) {
char *name = secfile_lookup_str(file, "%s.special_%d_name",
sec[i], j + 1);
@@ -1493,11 +1473,6 @@
t->special[j].name_orig[0] = '\0';
}
t->special[j].name = t->special[j].name_orig;
- output_type_iterate(o) {
- t->special[j].output[o]
- = secfile_lookup_int_default(file, 0, "%s.%s_special_%d", sec[i],
- get_output_identifier(o), j + 1);
- } output_type_iterate_end;
sz_strlcpy(t->special[j].graphic_str,
secfile_lookup_str(file,"%s.graphic_special_%d",
@@ -1507,20 +1482,14 @@
sec[i], j+1));
}
- t->road_trade_incr =
- secfile_lookup_int(file, "%s.road_trade_incr", sec[i]);
t->road_time = secfile_lookup_int(file, "%s.road_time", sec[i]);
t->irrigation_result =
lookup_terrain(secfile_lookup_str(file, "%s.irrigation_result",
sec[i]), i);
- t->irrigation_food_incr =
- secfile_lookup_int(file, "%s.irrigation_food_incr", sec[i]);
t->irrigation_time = secfile_lookup_int(file, "%s.irrigation_time",
sec[i]);
t->mining_result =
lookup_terrain(secfile_lookup_str(file, "%s.mining_result", sec[i]), i);
- t->mining_shield_incr =
- secfile_lookup_int(file, "%s.mining_shield_incr", sec[i]);
t->mining_time = secfile_lookup_int(file, "%s.mining_time", sec[i]);
t->transform_result =
@@ -1699,24 +1668,6 @@
}
} output_type_iterate_end;
- 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],
- get_output_identifier(o));
- g->celeb_output_before_penalty[o]
- = secfile_lookup_int_default(file, FC_INFINITY,
- "%s.production_%s_penalty,1", sec[i],
- get_output_identifier(o));
- } output_type_iterate_end;
-
g->helptext = lookup_helptext(file, sec[i]);
} government_iterate_end;
@@ -2729,12 +2680,6 @@
packet.movement_cost = t->movement_cost;
packet.defense_bonus = t->defense_bonus;
- output_type_iterate(o) {
- packet.output[o] = t->output[o];
- packet.output_special_1[o] = t->special[0].output[o];
- packet.output_special_2[o] = t->special[1].output[o];
- } output_type_iterate_end;
-
sz_strlcpy(packet.special_1_name, t->special[0].name_orig);
sz_strlcpy(packet.special_2_name, t->special[1].name_orig);
@@ -2744,15 +2689,12 @@
sz_strlcpy(packet.graphic_str_special_2, t->special[1].graphic_str);
sz_strlcpy(packet.graphic_alt_special_2, t->special[1].graphic_alt);
- packet.road_trade_incr = t->road_trade_incr;
packet.road_time = t->road_time;
packet.irrigation_result = t->irrigation_result;
- packet.irrigation_food_incr = t->irrigation_food_incr;
packet.irrigation_time = t->irrigation_time;
packet.mining_result = t->mining_result;
- packet.mining_shield_incr = t->mining_shield_incr;
packet.mining_time = t->mining_time;
packet.transform_result = t->transform_result;
@@ -2803,11 +2745,6 @@
gov.free_upkeep[o] = g->free_upkeep[o];
gov.unit_upkeep_factor[o] = g->unit_upkeep_factor[o];
- gov.output_before_penalty[o] = g->output_before_penalty[o];
- gov.celeb_output_before_penalty[o] = g->celeb_output_before_penalty[o];
- gov.output_inc_tile[o] = g->output_inc_tile[o];
- gov.celeb_output_inc_tile[o] = g->celeb_output_inc_tile[o];
-
gov.waste_level[o] = g->waste[o].level;
gov.fixed_waste_distance[o] = g->waste[o].fixed_distance;
gov.waste_distance_factor[o] = g->waste[o].distance_factor;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12504) RFC: use of effects for terrain/special data,
Jason Short <=
|
|