[Freeciv-Dev] (PR#12930) RFC: generalizing output types in effects
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12930 >
Here's an updated version of the patch. I renamed "output" as
"outputtype" in the code (requirements.h) and the ruleset.
It's incomplete because the other rulesets need to be updated.
-jason
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.220
diff -u -r1.220 aicity.c
--- ai/aicity.c 6 May 2005 16:01:42 -0000 1.220
+++ ai/aicity.c 7 May 2005 06:43:35 -0000
@@ -278,7 +278,9 @@
struct requirement *mypreq;
bool useful;
- if (is_effect_disabled(pplayer, pcity, pimpr, NULL, NULL, peffect)) {
+ if (is_effect_disabled(pplayer, pcity, pimpr,
+ NULL, NULL, NULL,
+ peffect)) {
CITY_LOG(LOG_DEBUG, pcity, "%s has a disabled effect: %s",
get_improvement_name(id), effect_type_name(peffect->type));
continue;
@@ -294,7 +296,7 @@
mypreq = preq;
continue;
}
- if (!is_req_active(pplayer, pcity, pimpr, NULL, NULL, preq)) {
+ if (!is_req_active(pplayer, pcity, pimpr, NULL, NULL, NULL, preq)) {
useful = FALSE;
break;
}
@@ -315,29 +317,12 @@
case EFT_UPKEEP_FREE:
case EFT_POLLU_POP_PCT:
case EFT_POLLU_PROD_PCT:
- case EFT_TRADE_PER_TILE:
- case EFT_TRADE_INC_TILE:
- case EFT_FOOD_INC_TILE:
- case EFT_TRADE_ADD_TILE:
- case EFT_PROD_INC_TILE:
- case EFT_PROD_PER_TILE:
- case EFT_PROD_ADD_TILE:
- case EFT_FOOD_PER_TILE:
- case EFT_FOOD_ADD_TILE:
- case EFT_FOOD_BONUS:
- case EFT_PROD_BONUS:
- case EFT_TRADE_BONUS:
- case EFT_TAX_BONUS:
- case EFT_SCIENCE_BONUS:
- case EFT_LUXURY_BONUS:
- case EFT_FOOD_BONUS_2:
- case EFT_PROD_BONUS_2:
- case EFT_TRADE_BONUS_2:
- case EFT_TAX_BONUS_2:
- case EFT_SCIENCE_BONUS_2:
- case EFT_LUXURY_BONUS_2:
- case EFT_CORRUPT_PCT:
- case EFT_WASTE_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_WASTE_PCT:
break;
case EFT_SLOW_DOWN_TIMELINE:
@@ -1273,8 +1258,11 @@
**************************************************************************/
static bool building_unwanted(struct player *plr, Impr_type_id i)
{
+#if 0 /* This check will become more complicated now. */
return (ai_wants_no_science(plr)
&& building_has_effect(i, EFT_SCIENCE_BONUS));
+#endif
+ return FALSE;
}
/**************************************************************************
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.67
diff -u -r1.67 aidata.c
--- ai/aidata.c 5 May 2005 20:00:41 -0000 1.67
+++ ai/aidata.c 7 May 2005 06:43:35 -0000
@@ -289,23 +289,15 @@
case EFT_MAKE_CONTENT_PCT:
case EFT_MAKE_HAPPY:
#endif
- case EFT_LUXURY_BONUS:
- case EFT_SCIENCE_BONUS:
- case EFT_TAX_BONUS:
case EFT_CAPITAL_CITY:
- case EFT_CORRUPT_PCT:
- case EFT_FOOD_ADD_TILE:
- case EFT_FOOD_INC_TILE:
- case EFT_FOOD_PER_TILE:
case EFT_POLLU_POP_PCT:
case EFT_POLLU_PROD_PCT:
- case EFT_PROD_ADD_TILE:
- case EFT_PROD_BONUS:
- case EFT_PROD_INC_TILE:
- case EFT_PROD_PER_TILE:
- case EFT_TRADE_ADD_TILE:
- case EFT_TRADE_INC_TILE:
- case EFT_TRADE_PER_TILE:
+ 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_WASTE_PCT:
case EFT_UPKEEP_FREE:
requirement_list_iterate(peffect->reqs, preq) {
if (preq->source.type == REQ_BUILDING
Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.76
diff -u -r1.76 citydlg_common.c
--- client/citydlg_common.c 5 May 2005 18:32:46 -0000 1.76
+++ client/citydlg_common.c 7 May 2005 06:43:36 -0000
@@ -386,6 +386,7 @@
int total = 0;
int priority;
int tax[O_COUNT];
+ struct output_type *output = &output_types[otype];
buf[0] = '\0';
@@ -430,13 +431,13 @@
}
for (priority = 0; priority < 2; priority++) {
- enum effect_type eft = get_output_bonus_effect(otype, priority);
+ enum effect_type eft[] = {EFT_OUTPUT_BONUS, EFT_OUTPUT_BONUS_2};
- if (eft != EFT_LAST) {
+ {
int base = total, bonus = 100;
struct effect_list *plist = effect_list_new();
- (void) get_city_bonus_effects(plist, pcity, eft);
+ (void) get_city_bonus_effects(plist, pcity, output, eft[priority]);
effect_list_iterate(plist, peffect) {
char buf2[512];
Index: client/helpdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/helpdata.c,v
retrieving revision 1.113
diff -u -r1.113 helpdata.c
--- client/helpdata.c 7 May 2005 03:48:34 -0000 1.113
+++ client/helpdata.c 7 May 2005 06:43:36 -0000
@@ -194,6 +194,10 @@
cat_snprintf(buf, bufsz, _("Only applies to %s units.\n\n"),
get_unit_flag_name(req->source.value.unitflag));
return;
+ case REQ_OUTPUTTYPE:
+ cat_snprintf(buf, bufsz, _("Applies only to %s.\n\n"),
+ get_output_name(req->source.value.outputtype));
+ return;
case REQ_MINSIZE:
cat_snprintf(buf, bufsz, _("Requires a minimum size of %d.\n\n"),
req->source.value.minsize);
Index: client/text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.c,v
retrieving revision 1.39
diff -u -r1.39 text.c
--- client/text.c 5 May 2005 20:26:13 -0000 1.39
+++ client/text.c 7 May 2005 06:43:36 -0000
@@ -832,7 +832,7 @@
add_line(_("Buildings: "));
- get_city_bonus_effects(plist, pcity, EFT_MAKE_CONTENT);
+ get_city_bonus_effects(plist, pcity, NULL, EFT_MAKE_CONTENT);
effect_list_iterate(plist, peffect) {
if (faces != 0) {
@@ -865,9 +865,9 @@
INIT;
add_line(_("Wonders: "));
- get_city_bonus_effects(plist, pcity, EFT_MAKE_HAPPY);
- get_city_bonus_effects(plist, pcity, EFT_FORCE_CONTENT);
- get_city_bonus_effects(plist, pcity, EFT_NO_UNHAPPY);
+ get_city_bonus_effects(plist, pcity, NULL, EFT_MAKE_HAPPY);
+ get_city_bonus_effects(plist, pcity, NULL, EFT_FORCE_CONTENT);
+ get_city_bonus_effects(plist, pcity, NULL, EFT_NO_UNHAPPY);
effect_list_iterate(plist, peffect) {
if (faces != 0) {
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.341
diff -u -r1.341 city.c
--- common/city.c 6 May 2005 16:01:42 -0000 1.341
+++ common/city.c 7 May 2005 06:43:37 -0000
@@ -255,150 +255,21 @@
}
/**************************************************************************
- Return the effect for the production bonus for this output type.
+ Find the output type for this output identifier.
**************************************************************************/
-inline enum effect_type get_output_bonus_effect(Output_type_id otype,
- int priority)
+Output_type_id find_output_type_by_identifier(const char *id)
{
- switch (priority) {
- case 0:
- switch (otype) {
- case O_FOOD:
- return EFT_FOOD_BONUS;
- case O_SHIELD:
- return EFT_PROD_BONUS;
- case O_TRADE:
- return EFT_TRADE_BONUS;
- case O_GOLD:
- return EFT_TAX_BONUS;
- case O_LUXURY:
- return EFT_LUXURY_BONUS;
- case O_SCIENCE:
- return EFT_SCIENCE_BONUS;
- case O_LAST:
- break;
- }
- break;
- case 1:
- switch (otype) {
- case O_FOOD:
- return EFT_FOOD_BONUS_2;
- case O_SHIELD:
- return EFT_PROD_BONUS_2;
- case O_TRADE:
- return EFT_TRADE_BONUS_2;
- case O_GOLD:
- return EFT_TAX_BONUS_2;
- case O_LUXURY:
- return EFT_LUXURY_BONUS_2;
- case O_SCIENCE:
- return EFT_SCIENCE_BONUS_2;
- case O_LAST:
- break;
- }
- break;
- }
- assert(0);
- return EFT_LAST;
-}
-
-/**************************************************************************
- Return the effect for waste reduction for this output type.
-**************************************************************************/
-static inline enum effect_type get_output_waste_effect(Output_type_id otype)
-{
- switch (otype) {
- case O_SHIELD:
- return EFT_WASTE_PCT;
- case O_TRADE:
- return EFT_CORRUPT_PCT;
- case O_FOOD:
- case O_GOLD:
- case O_LUXURY:
- case O_SCIENCE:
- return EFT_LAST;
- case O_LAST:
- break;
- }
-
- assert(0);
- return EFT_LAST;
-}
-
-/**************************************************************************
- Return the effect for add-tile city bonuses for this output type.
-**************************************************************************/
-static inline enum effect_type get_output_add_tile_effect(Output_type_id o)
-{
- switch (o) {
- case O_FOOD:
- return EFT_FOOD_ADD_TILE;
- case O_SHIELD:
- return EFT_PROD_ADD_TILE;
- case O_TRADE:
- return EFT_TRADE_ADD_TILE;
- case O_GOLD:
- case O_LUXURY:
- case O_SCIENCE:
- return EFT_LAST;
- case O_LAST:
- break;
- }
+ Output_type_id o;
- assert(0);
- return EFT_LAST;
-}
-
-/**************************************************************************
- Return the effect for inc-tile city bonuses for this output type.
-**************************************************************************/
-static inline enum effect_type get_output_inc_tile_effect(Output_type_id o)
-{
- switch (o) {
- case O_FOOD:
- return EFT_FOOD_INC_TILE;
- case O_SHIELD:
- return EFT_PROD_INC_TILE;
- case O_TRADE:
- return EFT_TRADE_INC_TILE;
- case O_GOLD:
- case O_LUXURY:
- case O_SCIENCE:
- return EFT_LAST;
- case O_LAST:
- break;
- }
-
- assert(0);
- return EFT_LAST;
-}
-
-/**************************************************************************
- Return the effect for per-tile city bonuses for this output type.
-**************************************************************************/
-static inline enum effect_type get_output_per_tile_effect(Output_type_id o)
-{
- switch (o) {
- case O_FOOD:
- return EFT_FOOD_PER_TILE;
- case O_SHIELD:
- return EFT_PROD_PER_TILE;
- case O_TRADE:
- return EFT_TRADE_PER_TILE;
- case O_GOLD:
- case O_LUXURY:
- case O_SCIENCE:
- return EFT_LAST;
- case O_LAST:
- break;
+ for (o = 0; o < O_LAST; o++) {
+ if (mystrcasecmp(output_types[o].name, id) == 0) {
+ return o;
+ }
}
- assert(0);
- return EFT_LAST;
+ return O_LAST;
}
-
-
/**************************************************************************
Set the worker on the citymap. Also sets the worked field in the map.
**************************************************************************/
@@ -525,7 +396,8 @@
if (building->req[i].source.type == REQ_NONE) {
break;
}
- if (!is_req_active(city_owner(pcity), pcity, NULL, pcity->tile, NULL,
+ if (!is_req_active(city_owner(pcity), pcity, NULL,
+ pcity->tile, NULL, NULL,
&building->req[i])) {
return FALSE;
}
@@ -572,7 +444,8 @@
break;
}
if (is_req_unchanging(&building->req[r])
- && !is_req_active(city_owner(pcity), pcity, NULL, pcity->tile, NULL,
+ && !is_req_active(city_owner(pcity), pcity, NULL,
+ pcity->tile, NULL, NULL,
&building->req[r])) {
return FALSE;
}
@@ -650,7 +523,7 @@
bool city_can_use_specialist(const struct city *pcity,
Specialist_type_id type)
{
- return are_reqs_active(city_owner(pcity), pcity, NULL, NULL, NULL,
+ return are_reqs_active(city_owner(pcity), pcity, NULL, NULL, NULL, NULL,
game.rgame.specialists[type].req, MAX_NUM_REQS);
}
@@ -710,6 +583,7 @@
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];
assert(otype >= 0 && otype < O_LAST);
@@ -769,27 +643,21 @@
int before_penalty = (is_celebrating
? g->celeb_output_before_penalty[otype]
: g->output_before_penalty[otype]);
- enum effect_type add = get_output_add_tile_effect(otype);
- enum effect_type inc = get_output_inc_tile_effect(otype);
- enum effect_type per = get_output_per_tile_effect(otype);
- if (add != EFT_LAST) {
- prod += get_city_tile_bonus(pcity, ptile, add);
- }
+ prod += get_city_tile_output_bonus(pcity, ptile, output,
+ EFT_OUTPUT_ADD_TILE);
/* Government & effect bonus/penalty. */
if (prod > 0) {
prod += (is_celebrating
? g->celeb_output_inc_tile[otype]
: g->output_inc_tile[otype]);
- if (inc != EFT_LAST) {
- prod += get_city_tile_bonus(pcity, ptile, inc);
- }
+ prod += get_city_tile_output_bonus(pcity, ptile, output,
+ EFT_OUTPUT_INC_TILE);
}
- if (per != EFT_LAST) {
- prod += (prod * get_city_tile_bonus(pcity, ptile, per)) / 100;
- }
+ prod += (prod * get_city_tile_output_bonus(pcity, ptile, output,
+ EFT_OUTPUT_PER_TILE)) / 100;
if (before_penalty > 0 && prod > before_penalty) {
prod--;
@@ -1238,7 +1106,7 @@
while ((replace = city_styles[prev].replaced_by) != -1) {
prev = replace;
- if (are_reqs_active(plr, NULL, NULL, NULL, NULL,
+ if (are_reqs_active(plr, NULL, NULL, NULL, NULL, NULL,
city_styles[replace].req, MAX_NUM_REQS)) {
style = replace;
}
@@ -1577,17 +1445,13 @@
**************************************************************************/
int get_city_output_bonus(const struct city *pcity, Output_type_id otype)
{
- int bonus = 100, i;
-
- for (i = 0; i < 2; i++) {
- enum effect_type eft = get_output_bonus_effect(otype, i);
-
- if (eft != EFT_LAST) {
- bonus = bonus * (100 + get_city_bonus(pcity, eft)) / 100;
- }
- }
+ struct output_type *output = &output_types[otype];
+ int bonus1 = 100 + get_city_tile_output_bonus(pcity, NULL, output,
+ EFT_OUTPUT_BONUS);
+ int bonus2 = 100 + get_city_tile_output_bonus(pcity, NULL, output,
+ EFT_OUTPUT_BONUS_2);
- return bonus;
+ return bonus1 * bonus2 / 100;
}
/**************************************************************************
@@ -2322,7 +2186,6 @@
unsigned int val;
int penalty = 0;
struct gov_waste *waste = &g->waste[otype];
- enum effect_type eft = get_output_waste_effect(otype);
if (otype == O_TRADE) {
/* FIXME: special case for trade: it is affected by notradesize and
@@ -2364,9 +2227,11 @@
/* Now calculate the final waste. Ordered to reduce integer
* roundoff errors. */
val = total * MAX(dist, 1) * waste->level;
- if (eft != EFT_LAST) {
- val -= (val * get_city_bonus(pcity, eft)) / 100;
- }
+
+ /* FIXME: should be a get_city_output_bonus? */
+ val -= (val * get_city_tile_output_bonus(pcity, NULL, &output_types[otype],
+ EFT_OUTPUT_WASTE_PCT)) / 100;
+
val /= 100 * 100; /* Level is a % multiplied by 100 */
val = CLIP(penalty, val, total);
return val;
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.210
diff -u -r1.210 city.h
--- common/city.h 4 May 2005 17:56:06 -0000 1.210
+++ common/city.h 7 May 2005 06:43:37 -0000
@@ -369,8 +369,7 @@
const char *get_output_identifier(Output_type_id output);
const char *get_output_name(Output_type_id output);
-enum effect_type get_output_bonus_effect(Output_type_id otype,
- int priority);
+Output_type_id find_output_type_by_identifier(const char *id);
/* properties */
Index: common/effects.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.c,v
retrieving revision 1.38
diff -u -r1.38 effects.c
--- common/effects.c 6 May 2005 16:01:42 -0000 1.38
+++ common/effects.c 7 May 2005 06:43:37 -0000
@@ -41,22 +41,19 @@
"Airlift",
"Any_Government",
"Capital_City",
- "Corrupt_Pct",
- "Waste_Pct",
"Enable_Nuke",
"Enable_Space",
- "Food_Add_Tile",
- "Food_Bonus",
- /* TODO: "Food_Pct", */
- "Food_Inc_Tile",
- "Food_Per_Tile",
+ "Output_Bonus",
+ "Output_Bonus_2",
+ "Output_Add_Tile",
+ "Output_Inc_Tile",
+ "Output_Per_Tile",
+ "Output_Waste_Pct",
"Force_Content",
/* TODO: "Force_Content_Pct", */
"Give_Imm_Tech",
"Growth_Food",
"Have_Embassies",
- "Luxury_Bonus",
- /* TODO: "Luxury_Pct", */
"Make_Content",
"Make_Content_Mil",
"Make_Content_Mil_Per",
@@ -71,37 +68,17 @@
"Pollu_Pop_Pct",
/* TODO: "Pollu_Prod_Adj", */
"Pollu_Prod_Pct",
- "Prod_Add_Tile",
- "Prod_Bonus",
- /* TODO: "Prod_Pct", */
- "Prod_Inc_Tile",
- "Prod_Per_Tile",
"Prod_To_Gold",
"Reveal_Cities",
"Reveal_Map",
/* TODO: "Incite_Dist_Adj", */
"Incite_Dist_Pct",
- "Science_Bonus",
- /* TODO: "Science_Pct", */
"Size_Adj",
"Size_Unlimit",
"SS_Structural",
"SS_Component",
"SS_Module",
"Spy_Resistant",
- "Tax_Bonus",
- /* TODO: "Tax_Pct", */
- "Trade_Add_Tile",
- "Trade_Bonus",
- /* TODO: "Trade_Pct", */
- "Trade_Inc_Tile",
- "Trade_Per_Tile",
- "Food_Bonus_2",
- "Prod_Bonus_2",
- "Trade_Bonus_2",
- "Tax_Bonus_2",
- "Luxury_Bonus_2",
- "Science_Bonus_2",
"Sea_Move",
"Unit_No_Lose_Pop",
"Unit_Recover",
@@ -578,11 +555,13 @@
const struct impr_type *target_building,
const struct tile *target_tile,
const struct unit *target_unit,
+ const struct output_type *target_output,
const struct effect *peffect)
{
requirement_list_iterate(peffect->nreqs, preq) {
if (is_req_active(target_player, target_city, target_building,
- target_tile, target_unit, preq)) {
+ target_tile, target_unit, target_output,
+ preq)) {
return TRUE;
}
} requirement_list_iterate_end;
@@ -599,11 +578,13 @@
const struct impr_type *target_building,
const struct tile *target_tile,
const struct unit *target_unit,
+ const struct output_type *target_output,
const struct effect *peffect)
{
requirement_list_iterate(peffect->reqs, preq) {
if (!is_req_active(target_player, target_city, target_building,
- target_tile, target_unit, preq)) {
+ target_tile, target_unit, target_output,
+ preq)) {
return FALSE;
}
} requirement_list_iterate_end;
@@ -624,12 +605,15 @@
const struct impr_type *target_building,
const struct tile *target_tile,
const struct unit *target_unit,
+ const struct output_type *target_output,
const struct effect *peffect)
{
return is_effect_enabled(target_player, target_city, target_building,
- target_tile, target_unit, peffect)
+ target_tile, target_unit, target_output,
+ peffect)
&& !is_effect_disabled(target_player, target_city, target_building,
- target_tile, target_unit, peffect);
+ target_tile, target_unit, target_output,
+ peffect);
}
/**************************************************************************
@@ -649,10 +633,11 @@
const struct impr_type *target_building,
const struct tile *target_tile,
const struct unit *target_unit,
+ const struct output_type *target_output,
Impr_type_id source, const struct effect *peffect)
{
- if (is_effect_disabled(target_player, target_city,
- target_building, target_tile, target_unit,
+ if (is_effect_disabled(target_player, target_city, target_building,
+ target_tile, target_unit, target_output,
peffect)) {
return FALSE;
}
@@ -662,7 +647,8 @@
continue;
}
if (!is_req_active(target_player, target_city, target_building,
- target_tile, target_unit, preq)) {
+ target_tile, target_unit, target_output,
+ preq)) {
return FALSE;
}
} requirement_list_iterate_end;
@@ -693,7 +679,7 @@
* the building is its own target - but whether this is actually
* checked depends on the range of the effect. */
if (!is_effect_disabled(city_owner(pcity), pcity,
- get_improvement_type(building), NULL, NULL,
+ get_improvement_type(building), NULL, NULL, NULL,
peffect)) {
return FALSE;
}
@@ -719,6 +705,7 @@
const struct impr_type *target_building,
const struct tile *target_tile,
const struct unit *target_unit,
+ const struct output_type *target_output,
enum effect_type effect_type)
{
int bonus = 0;
@@ -726,8 +713,8 @@
/* Loop over all effects of this type. */
effect_list_iterate(get_effects(effect_type), peffect) {
/* For each effect, see if it is active. */
- if (is_effect_active(target_player, target_city,
- target_building, target_tile, target_unit,
+ if (is_effect_active(target_player, target_city, target_building,
+ target_tile, target_unit, target_output,
peffect)) {
/* And if so add on the value. */
bonus += peffect->value;
@@ -750,7 +737,8 @@
return 0;
}
- return get_target_bonus_effects(NULL, NULL, NULL, NULL, NULL, NULL,
+ return get_target_bonus_effects(NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
effect_type);
}
@@ -764,7 +752,8 @@
return 0;
}
- return get_target_bonus_effects(NULL, pplayer, NULL, NULL, NULL, NULL,
+ return get_target_bonus_effects(NULL,
+ pplayer, NULL, NULL, NULL, NULL, NULL,
effect_type);
}
@@ -777,7 +766,8 @@
return 0;
}
- return get_target_bonus_effects(NULL, city_owner(pcity), pcity,
+ return get_target_bonus_effects(NULL,
+ city_owner(pcity), pcity, NULL,
NULL, NULL, NULL,
effect_type);
}
@@ -785,13 +775,15 @@
/**************************************************************************
Returns the effect bonus at a city tile.
**************************************************************************/
-int get_city_tile_bonus(const struct city *pcity, const struct tile *ptile,
- enum effect_type effect_type)
+int get_city_tile_output_bonus(const struct city *pcity,
+ const struct tile *ptile,
+ const struct output_type *poutput,
+ enum effect_type effect_type)
{
assert(pcity != NULL && ptile != NULL);
return get_target_bonus_effects(NULL,
- city_owner(pcity), pcity, NULL, ptile,
- NULL,
+ city_owner(pcity), pcity, NULL,
+ ptile, NULL, poutput,
effect_type);
}
@@ -804,7 +796,8 @@
assert(pcity != NULL && id != B_LAST);
return get_target_bonus_effects(NULL,
city_owner(pcity), pcity,
- get_improvement_type(id), NULL, NULL,
+ get_improvement_type(id),
+ NULL, NULL, NULL,
effect_type);
}
@@ -814,8 +807,9 @@
int get_unit_bonus(const struct unit *punit, enum effect_type effect_type)
{
assert(punit != NULL);
- return get_target_bonus_effects(NULL, unit_owner(punit), NULL,
- NULL, NULL, punit,
+ return get_target_bonus_effects(NULL,
+ unit_owner(punit), NULL, NULL,
+ NULL, punit, NULL,
effect_type);
}
@@ -831,7 +825,8 @@
{
assert(pplayer != NULL);
return get_target_bonus_effects(plist,
- pplayer, NULL, NULL, NULL, NULL,
+ pplayer, NULL, NULL,
+ NULL, NULL, NULL,
effect_type);
}
@@ -843,11 +838,13 @@
**************************************************************************/
int get_city_bonus_effects(struct effect_list *plist,
const struct city *pcity,
+ const struct output_type *poutput,
enum effect_type effect_type)
{
assert(pcity != NULL);
return get_target_bonus_effects(plist,
- city_owner(pcity), pcity, NULL, NULL, NULL,
+ city_owner(pcity), pcity, NULL,
+ NULL, NULL, poutput,
effect_type);
}
@@ -877,8 +874,9 @@
if (peffect->type != effect_type) {
continue;
}
- if (is_effect_useful(city_owner(pcity),
- pcity, building, NULL, NULL, id, peffect)) {
+ if (is_effect_useful(city_owner(pcity), pcity, building,
+ NULL, NULL, NULL,
+ id, peffect)) {
power += peffect->value;
}
} effect_list_iterate_end;
Index: common/effects.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.h,v
retrieving revision 1.23
diff -u -r1.23 effects.h
--- common/effects.h 6 May 2005 16:01:42 -0000 1.23
+++ common/effects.h 7 May 2005 06:43:37 -0000
@@ -28,22 +28,19 @@
EFT_AIRLIFT,
EFT_ANY_GOVERNMENT,
EFT_CAPITAL_CITY,
- EFT_CORRUPT_PCT,
- EFT_WASTE_PCT,
EFT_ENABLE_NUKE,
EFT_ENABLE_SPACE,
- EFT_FOOD_ADD_TILE,
- EFT_FOOD_BONUS,
- /*TODO: EFT_FOOD_PCT, */
- EFT_FOOD_INC_TILE,
- EFT_FOOD_PER_TILE,
+ EFT_OUTPUT_BONUS,
+ EFT_OUTPUT_BONUS_2,
+ EFT_OUTPUT_ADD_TILE,
+ EFT_OUTPUT_INC_TILE,
+ EFT_OUTPUT_PER_TILE,
+ EFT_OUTPUT_WASTE_PCT,
EFT_FORCE_CONTENT,
/* TODO: EFT_FORCE_CONTENT_PCT, */
EFT_GIVE_IMM_TECH,
EFT_GROWTH_FOOD,
EFT_HAVE_EMBASSIES,
- EFT_LUXURY_BONUS,
- /* TODO: EFT_LUXURY_PCT, */
EFT_MAKE_CONTENT,
EFT_MAKE_CONTENT_MIL,
EFT_MAKE_CONTENT_MIL_PER,
@@ -58,37 +55,18 @@
EFT_POLLU_POP_PCT,
/* TODO: EFT_POLLU_PROD_ADJ, */
EFT_POLLU_PROD_PCT,
- EFT_PROD_ADD_TILE,
- EFT_PROD_BONUS,
/* TODO: EFT_PROD_PCT, */
- EFT_PROD_INC_TILE,
- EFT_PROD_PER_TILE,
EFT_PROD_TO_GOLD,
EFT_REVEAL_CITIES,
EFT_REVEAL_MAP,
/* TODO: EFT_INCITE_DIST_ADJ, */
EFT_INCITE_DIST_PCT,
- EFT_SCIENCE_BONUS,
- /* TODO: EFT_SCIENCE_PCT, */
EFT_SIZE_ADJ,
EFT_SIZE_UNLIMIT,
EFT_SS_STRUCTURAL,
EFT_SS_COMPONENT,
EFT_SS_MODULE,
EFT_SPY_RESISTANT,
- EFT_TAX_BONUS,
- /* TODO: EFT_TAX_PCT, */
- EFT_TRADE_ADD_TILE,
- EFT_TRADE_BONUS,
- /* TODO: EFT_TRADE_PCT, */
- EFT_TRADE_INC_TILE,
- EFT_TRADE_PER_TILE,
- EFT_FOOD_BONUS_2,
- EFT_PROD_BONUS_2,
- EFT_TRADE_BONUS_2,
- EFT_TAX_BONUS_2,
- EFT_LUXURY_BONUS_2,
- EFT_SCIENCE_BONUS_2,
EFT_SEA_MOVE,
EFT_UNIT_NO_LOSE_POP,
EFT_UNIT_RECOVER,
@@ -181,6 +159,7 @@
const struct impr_type *target_building,
const struct tile *target_tile,
const struct unit *target_unit,
+ const struct output_type *target_output,
Impr_type_id source, const struct effect *effect);
bool is_building_replaced(const struct city *pcity, Impr_type_id building);
@@ -189,8 +168,10 @@
int get_world_bonus(enum effect_type effect_type);
int get_player_bonus(const struct player *plr, enum effect_type effect_type);
int get_city_bonus(const struct city *pcity, enum effect_type effect_type);
-int get_city_tile_bonus(const struct city *pcity, const struct tile *ptile,
- enum effect_type effect_type);
+int get_city_tile_output_bonus(const struct city *pcity,
+ const struct tile *ptile,
+ const struct output_type *poutput,
+ enum effect_type effect_type);
int get_building_bonus(const struct city *pcity, Impr_type_id building,
enum effect_type effect_type);
int get_unit_bonus(const struct unit *punit, enum effect_type effect_type);
@@ -202,12 +183,15 @@
const struct impr_type *target_building,
const struct tile *target_tile,
const struct unit *target_unit,
+ const struct output_type *target_output,
const struct effect *peffect);
int get_player_bonus_effects(struct effect_list *plist,
const struct player *pplayer, enum effect_type effect_type);
int get_city_bonus_effects(struct effect_list *plist,
- const struct city *pcity, enum effect_type effect_type);
+ const struct city *pcity,
+ const struct output_type *poutput,
+ enum effect_type effect_type);
bool building_has_effect(Impr_type_id building,
enum effect_type effect_type);
Index: common/government.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/government.c,v
retrieving revision 1.56
diff -u -r1.56 government.c
--- common/government.c 6 May 2005 16:01:42 -0000 1.56
+++ common/government.c 7 May 2005 06:43:37 -0000
@@ -148,7 +148,7 @@
return TRUE;
}
- return are_reqs_active(pplayer, NULL, NULL, NULL, NULL,
+ return are_reqs_active(pplayer, NULL, NULL, NULL, NULL, NULL,
gov->req, MAX_NUM_REQS);
}
Index: common/improvement.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/improvement.c,v
retrieving revision 1.60
diff -u -r1.60 improvement.c
--- common/improvement.c 6 May 2005 16:01:42 -0000 1.60
+++ common/improvement.c 7 May 2005 06:43:38 -0000
@@ -305,7 +305,8 @@
break;
}
if (impr->req[i].range >= REQ_RANGE_PLAYER
- && !is_req_active(p, NULL, 0, NULL, NULL, &impr->req[i])) {
+ && !is_req_active(p, NULL, NULL, NULL, NULL, NULL,
+ &impr->req[i])) {
return FALSE;
}
}
@@ -389,7 +390,8 @@
}
if (building->req[r].range >= REQ_RANGE_PLAYER
&& is_req_unchanging(&building->req[r])
- && !is_req_active(p, NULL, NULL, NULL, NULL, &building->req[r])) {
+ && !is_req_active(p, NULL, NULL, NULL, NULL, NULL,
+ &building->req[r])) {
return FALSE;
}
}
Index: common/requirements.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/requirements.c,v
retrieving revision 1.21
diff -u -r1.21 requirements.c
--- common/requirements.c 6 May 2005 23:13:53 -0000 1.21
+++ common/requirements.c 7 May 2005 06:43:38 -0000
@@ -38,6 +38,7 @@
"Nation",
"UnitType",
"UnitFlag",
+ "OutputType",
"MinSize"
};
@@ -150,6 +151,12 @@
return source;
}
break;
+ case REQ_OUTPUTTYPE:
+ source.value.outputtype = find_output_type_by_identifier(value);
+ if (source.value.outputtype != O_LAST) {
+ return source;
+ }
+ break;
case REQ_MINSIZE:
source.value.minsize = atoi(value);
if (source.value.minsize > 0) {
@@ -202,6 +209,9 @@
case REQ_UNITFLAG:
source.value.unitflag = value;
return source;
+ case REQ_OUTPUTTYPE:
+ source.value.outputtype = value;
+ return source;
case REQ_MINSIZE:
source.value.minsize = value;
return source;
@@ -251,6 +261,9 @@
case REQ_UNITFLAG:
*value = source->value.unitflag;
return;
+ case REQ_OUTPUTTYPE:
+ *value = source->value.outputtype;
+ return;
case REQ_MINSIZE:
*value = source->value.minsize;
return;
@@ -291,6 +304,7 @@
case REQ_TERRAIN:
case REQ_UNITTYPE:
case REQ_UNITFLAG:
+ case REQ_OUTPUTTYPE:
req.range = REQ_RANGE_LOCAL;
break;
case REQ_MINSIZE:
@@ -337,6 +351,9 @@
case REQ_UNITFLAG:
invalid = (req.range != REQ_RANGE_LOCAL);
break;
+ case REQ_OUTPUTTYPE:
+ invalid = (req.range != REQ_RANGE_LOCAL);
+ break;
case REQ_NONE:
invalid = FALSE;
break;
@@ -701,6 +718,7 @@
const struct impr_type *target_building,
const struct tile *target_tile,
const struct unit *target_unit,
+ const struct output_type *target_output,
const struct requirement *req)
{
/* Note the target may actually not exist. In particular, effects that
@@ -745,6 +763,9 @@
return is_unitflag_in_range(target_unit,
req->range, req->survives,
req->source.value.unitflag);
+ case REQ_OUTPUTTYPE:
+ return (target_output
+ && target_output->index == req->source.value.outputtype);
case REQ_MINSIZE:
return target_city && target_city->size >= req->source.value.minsize;
case REQ_LAST:
@@ -774,6 +795,7 @@
const struct impr_type *target_building,
const struct tile *target_tile,
const struct unit *target_unit,
+ const struct output_type *target_output,
const struct requirement *reqs, int num_reqs)
{
int i;
@@ -781,8 +803,8 @@
for (i = 0; i < num_reqs; i++) {
if (reqs[i].source.type == REQ_NONE) {
break; /* Short-circuit any more checks. */
- } else if (!is_req_active(target_player, target_city,
- target_building, target_tile, target_unit,
+ } else if (!is_req_active(target_player, target_city, target_building,
+ target_tile, target_unit, target_output,
&reqs[i])) {
return FALSE;
}
@@ -806,6 +828,7 @@
switch (req->source.type) {
case REQ_NATION:
case REQ_NONE:
+ case REQ_OUTPUTTYPE:
return TRUE;
case REQ_TECH:
case REQ_GOV:
@@ -857,6 +880,8 @@
return psource1->value.unittype == psource2->value.unittype;
case REQ_UNITFLAG:
return psource1->value.unitflag == psource2->value.unitflag;
+ case REQ_OUTPUTTYPE:
+ return psource1->value.outputtype == psource2->value.outputtype;
case REQ_MINSIZE:
return psource1->value.minsize == psource2->value.minsize;
case REQ_LAST:
@@ -903,6 +928,9 @@
cat_snprintf(buf, bufsz, _("%s units"),
get_unit_flag_name(psource->value.unitflag));
break;
+ case REQ_OUTPUTTYPE:
+ mystrlcat(buf, get_output_name(psource->value.outputtype), bufsz);
+ break;
case REQ_MINSIZE:
cat_snprintf(buf, bufsz, _("Size %d"),
psource->value.minsize);
Index: common/requirements.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/requirements.h,v
retrieving revision 1.15
diff -u -r1.15 requirements.h
--- common/requirements.h 6 May 2005 23:13:53 -0000 1.15
+++ common/requirements.h 7 May 2005 06:43:38 -0000
@@ -30,6 +30,7 @@
REQ_NATION,
REQ_UNITTYPE,
REQ_UNITFLAG,
+ REQ_OUTPUTTYPE,
REQ_MINSIZE, /* Minimum size: at city range means city size */
REQ_LAST
};
@@ -59,6 +60,7 @@
Nation_type_id nation; /* source nation type */
Unit_type_id unittype; /* source unittype */
enum unit_flag_id unitflag; /* source unit flag */
+ Output_type_id outputtype; /* source output type */
int minsize; /* source minsize type */
} value; /* source value */
};
@@ -106,12 +108,14 @@
const struct impr_type *target_building,
const struct tile *target_tile,
const struct unit *target_unit,
+ const struct output_type *target_output,
const struct requirement *req);
bool are_reqs_active(const struct player *target_player,
const struct city *target_city,
const struct impr_type *target_building,
const struct tile *target_tile,
const struct unit *target_unit,
+ const struct output_type *target_output,
const struct requirement *reqs, int num_reqs);
bool is_req_unchanging(const struct requirement *req);
Index: data/default/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/effects.ruleset,v
retrieving revision 1.8
diff -u -r1.8 effects.ruleset
--- data/default/effects.ruleset 5 May 2005 21:14:57 -0000 1.8
+++ data/default/effects.ruleset 7 May 2005 06:43:38 -0000
@@ -388,21 +388,23 @@
}
[effect_bank]
-name = "Tax_Bonus"
+name = "Output_Bonus"
value = 50
reqs =
{ "type", "name", "range"
"Building", "Marketplace", "City"
"Building", "Bank", "City"
+ "OutputType", "Gold", "Local"
}
[effect_bank_1]
-name = "Luxury_Bonus"
+name = "Output_Bonus"
value = 50
reqs =
{ "type", "name", "range"
"Building", "Marketplace", "City"
"Building", "Bank", "City"
+ "OutputType", "Luxury", "Local"
}
[effect_barracks]
@@ -537,28 +539,29 @@
}
[effect_courthouse]
-name = "Corrupt_Pct"
+name = "Output_Waste_Pct"
value = 50
reqs =
{ "type", "name", "range"
"Building", "Courthouse", "City"
+ "OutputType", "Trade", "Local"
}
nreqs =
{ "type", "name", "range"
"Building", "Palace", "City"
}
-[effect_courthouse_1]
-name = "Waste_Pct"
-value = 50
-reqs =
- { "type", "name", "range"
- "Building", "Courthouse", "City"
- }
-nreqs =
- { "type", "name", "range"
- "Building", "Palace", "City"
- }
+;[effect_courthouse_1]
+;name = "Waste_Pct"
+;value = 50
+;reqs =
+; { "type", "name", "range"
+; "Building", "Courthouse", "City"
+; }
+;nreqs =
+; { "type", "name", "range"
+; "Building", "Palace", "City"
+; }
[effect_courthouse_2]
name = "Make_Content"
@@ -578,11 +581,12 @@
}
[effect_factory]
-name = "Prod_Bonus"
+name = "Output_Bonus"
value = 50
reqs =
{ "type", "name", "range"
"Building", "Factory", "City"
+ "OutputType", "Shield", "Local"
}
[effect_granary]
@@ -594,21 +598,23 @@
}
[effect_harbour]
-name = "Food_Add_Tile"
+name = "Output_Add_Tile"
value = 1
reqs =
{ "type", "name", "range"
"Terrain", "Ocean", "Local"
"Building", "Harbour", "City"
+ "OutputType", "Food", "Local"
}
[effect_hydro_plant]
-name = "Prod_Bonus"
+name = "Output_Bonus"
value = 25
reqs =
{ "type", "name", "range"
"Building", "Factory", "City"
"Building", "Hydro Plant", "City"
+ "OutputType", "Shield", "Local"
}
nreqs =
{ "type", "name", "range"
@@ -617,12 +623,13 @@
}
[effect_hydro_plant_1]
-name = "Prod_Bonus"
+name = "Output_Bonus"
value = 25
reqs =
{ "type", "name", "range"
"Building", "Mfg. Plant", "City"
"Building", "Hydro Plant", "City"
+ "OutputType", "Shield", "Local"
}
nreqs =
{ "type", "name", "range"
@@ -661,27 +668,30 @@
}
[effect_library]
-name = "Science_Bonus"
+name = "Output_Bonus"
value = 100
reqs =
{ "type", "name", "range"
"Building", "Library", "City"
+ "OutputType", "Science", "Local"
}
[effect_marketplace]
-name = "Tax_Bonus"
+name = "Output_Bonus"
value = 50
reqs =
{ "type", "name", "range"
"Building", "Marketplace", "City"
+ "OutputType", "Gold", "Local"
}
[effect_marketplace_1]
-name = "Luxury_Bonus"
+name = "Output_Bonus"
value = 50
reqs =
{ "type", "name", "range"
"Building", "Marketplace", "City"
+ "OutputType", "Luxury", "Local"
}
[effect_mass_transit]
@@ -693,21 +703,23 @@
}
[effect_mfg_plant]
-name = "Prod_Bonus"
+name = "Output_Bonus"
value = 50
reqs =
{ "type", "name", "range"
"Building", "Factory", "City"
"Building", "Mfg. Plant", "City"
+ "OutputType", "Shield", "Local"
}
[effect_nuclear_plant]
-name = "Prod_Bonus"
+name = "Output_Bonus"
value = 25
reqs =
{ "type", "name", "range"
"Building", "Factory", "City"
"Building", "Nuclear Plant", "City"
+ "OutputType", "Shield", "Local"
}
nreqs =
{ "type", "name", "range"
@@ -715,12 +727,13 @@
}
[effect_nuclear_plant_1]
-name = "Prod_Bonus"
+name = "Output_Bonus"
value = 25
reqs =
{ "type", "name", "range"
"Building", "Mfg. Plant", "City"
"Building", "Nuclear Plant", "City"
+ "OutputType", "Shield", "Local"
}
nreqs =
{ "type", "name", "range"
@@ -756,29 +769,31 @@
}
[effect_offshore_platform]
-name = "Prod_Add_Tile"
+name = "Output_Add_Tile"
value = 1
reqs =
{ "type", "name", "range"
"Terrain", "Ocean", "Local"
"Building", "Offshore Platform", "City"
+ "OutputType", "Shield", "Local"
}
[effect_palace]
-name = "Corrupt_Pct"
+name = "Output_Waste_Pct"
value = 50
reqs =
{ "type", "name", "range"
"Building", "Palace", "City"
+ "OutputType", "Trade", "Local"
}
-[effect_palace_1]
-name = "Waste_Pct"
-value = 50
-reqs =
- { "type", "name", "range"
- "Building", "Palace", "City"
- }
+;[effect_palace_1]
+;name = "Waste_Pct"
+;value = 50
+;reqs =
+; { "type", "name", "range"
+; "Building", "Palace", "City"
+; }
[effect_palace_2]
name = "Spy_Resistant"
@@ -847,12 +862,13 @@
}
[effect_power_plant]
-name = "Prod_Bonus"
+name = "Output_Bonus"
value = 25
reqs =
{ "type", "name", "range"
"Building", "Factory", "City"
"Building", "Power Plant", "City"
+ "OutputType", "Shield", "Local"
}
nreqs =
{ "type", "name", "range"
@@ -862,12 +878,13 @@
}
[effect_power_plant_1]
-name = "Prod_Bonus"
+name = "Output_Bonus"
value = 25
reqs =
{ "type", "name", "range"
"Building", "Mfg. Plant", "City"
"Building", "Power Plant", "City"
+ "OutputType", "Shield", "Local"
}
nreqs =
{ "type", "name", "range"
@@ -885,21 +902,23 @@
}
[effect_research_lab]
-name = "Science_Bonus"
+name = "Output_Bonus"
value = 100
reqs =
{ "type", "name", "range"
"Building", "Library", "City"
"Building", "Research Lab", "City"
+ "OutputType", "Science", "Local"
}
[effect_research_lab_1]
-name = "Science_Bonus"
+name = "Output_Bonus"
value = 100
reqs =
{ "type", "name", "range"
"Building", "University", "City"
"Building", "Research Lab", "City"
+ "OutputType", "Science", "Local"
}
[effect_sam_battery]
@@ -984,39 +1003,43 @@
}
[effect_stock_exchange]
-name = "Tax_Bonus"
+name = "Output_Bonus"
value = 50
reqs =
{ "type", "name", "range"
"Building", "Bank", "City"
"Building", "Stock Exchange", "City"
+ "OutputType", "Gold", "Local"
}
[effect_stock_exchange_1]
-name = "Luxury_Bonus"
+name = "Output_Bonus"
value = 50
reqs =
{ "type", "name", "range"
"Building", "Bank", "City"
"Building", "Stock Exchange", "City"
+ "OutputType", "Luxury", "Local"
}
[effect_super_highways]
-name = "Trade_Per_Tile"
+name = "Output_Per_Tile"
value = 50
reqs =
{ "type", "name", "range"
"Special", "Road", "Local"
"Building", "Super Highways", "City"
+ "OutputType", "Trade", "Local"
}
[effect_supermarket]
-name = "Food_Per_Tile"
+name = "Output_Per_Tile"
value = 50
reqs =
{ "type", "name", "range"
"Special", "Farmland", "Local"
"Building", "Supermarket", "City"
+ "OutputType", "Food", "Local"
}
[effect_temple]
@@ -1037,12 +1060,13 @@
}
[effect_university]
-name = "Science_Bonus"
+name = "Output_Bonus"
value = 150
reqs =
{ "type", "name", "range"
"Building", "Library", "City"
"Building", "University", "City"
+ "OutputType", "Science", "Local"
}
[effect_apollo_program]
@@ -1070,19 +1094,21 @@
}
[effect_colossus]
-name = "Trade_Inc_Tile"
+name = "Output_Inc_Tile"
value = 1
reqs =
{ "type", "name", "range"
"Building", "Colossus", "City"
+ "OutputType", "Trade", "Local"
}
[effect_copernicus_observatory]
-name = "Science_Bonus"
+name = "Output_Bonus"
value = 100
reqs =
{ "type", "name", "range"
"Building", "Copernicus' Observatory", "City"
+ "OutputType", "Science", "Local"
}
[effect_cure_for_cancer]
@@ -1150,21 +1176,23 @@
}
[effect_hoover_dam]
-name = "Prod_Bonus"
+name = "Output_Bonus"
value = 25
reqs =
{ "type", "name", "range"
"Building", "Factory", "City"
"Building", "Hoover Dam", "Player"
+ "OutputType", "Shield", "Local"
}
[effect_hoover_dam_1]
-name = "Prod_Bonus"
+name = "Output_Bonus"
value = 25
reqs =
{ "type", "name", "range"
"Building", "Mfg. Plant", "City"
"Building", "Hoover Dam", "Player"
+ "OutputType", "Shield", "Local"
}
[effect_hoover_dam_2]
@@ -1194,12 +1222,13 @@
}
[effect_isaac_newtons_college]
-name = "Science_Bonus"
+name = "Output_Bonus"
value = 100
reqs =
{ "type", "name", "range"
"Building", "University", "City"
"Building", "Isaac Newton's College", "Player"
+ "OutputType", "Science", "Local"
}
[effect_js_bachs_cathedral]
@@ -1211,11 +1240,12 @@
}
[effect_king_richards_crusade]
-name = "Prod_Add_Tile"
+name = "Output_Add_Tile"
value = 1
reqs =
{ "type", "name", "range"
"Building", "King Richard's Crusade", "City"
+ "OutputType", "Shield", "Local"
}
[effect_leonardos_workshop]
@@ -1318,12 +1348,13 @@
}
[effect_seti_program]
-name = "Science_Bonus"
+name = "Output_Bonus"
value = 100
reqs =
{ "type", "name", "range"
"Building", "Research Lab", "City"
"Building", "SETI Program", "Player"
+ "OutputType", "Science", "Local"
}
[effect_shakespeares_theatre]
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.322
diff -u -r1.322 citytools.c
--- server/citytools.c 6 May 2005 16:01:43 -0000 1.322
+++ server/citytools.c 7 May 2005 06:43:38 -0000
@@ -2065,7 +2065,8 @@
struct requirement *req = &get_improvement_type(impr)->req[r];
if (req->source.type == REQ_TERRAIN
- && !is_req_active(city_owner(pcity), pcity, NULL, NULL, NULL,
+ && !is_req_active(city_owner(pcity), pcity, NULL,
+ NULL, NULL, NULL,
req)) {
do_sell_building(pplayer, pcity, impr);
notify_player_ex(pplayer, tile1, E_IMP_SOLD,
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.312
diff -u -r1.312 cityturn.c
--- server/cityturn.c 6 May 2005 23:13:53 -0000 1.312
+++ server/cityturn.c 7 May 2005 06:43:39 -0000
@@ -693,7 +693,7 @@
if (req->source.type == REQ_NONE) {
break;
}
- if (!is_req_active(pplayer, pcity, NULL, NULL, NULL, req)) {
+ if (!is_req_active(pplayer, pcity, NULL, NULL, NULL, NULL, req)) {
known = TRUE;
switch (req->source.type) {
case REQ_TECH:
@@ -752,6 +752,9 @@
case REQ_UNITFLAG:
/* Will only happen with a bogus ruleset. */
break;
+ case REQ_OUTPUTTYPE:
+ /* Should never happen. */
+ break;
case REQ_MINSIZE:
notify_player_ex(pplayer, pcity->tile, E_CITY_CANTBUILD,
_("%s can't build %s from the worklist; "
Index: server/score.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/score.c,v
retrieving revision 1.20
diff -u -r1.20 score.c
--- server/score.c 5 May 2005 20:26:14 -0000 1.20
+++ server/score.c 7 May 2005 06:43:39 -0000
@@ -414,7 +414,8 @@
pplayer->score.bnp += pcity->surplus[O_TRADE];
pplayer->score.mfg += pcity->surplus[O_SHIELD];
- bonus = CLIP(0, get_city_bonus(pcity, EFT_SCIENCE_BONUS), 100);
+ bonus = get_city_output_bonus(pcity, O_SCIENCE) - 100;
+ bonus = CLIP(0, bonus, 100);
pplayer->score.literacy += (city_population(pcity) * bonus) / 100;
} city_list_iterate_end;
|
|