diff -Nur -Xfreecivdiff.ignore freeciv-cvs/client/packhand.c freeciv-patched/client/packhand.c --- freeciv-cvs/client/packhand.c 2003-07-24 16:59:32.000000000 +0100 +++ freeciv-patched/client/packhand.c 2003-07-24 16:59:32.000000000 +0100 @@ -466,6 +466,10 @@ pcity->disbanded_shields=packet->disbanded_shields; pcity->caravan_shields=packet->caravan_shields; + if (city_is_new) { + update_city_bonuses(pcity); + } + i=0; for(y=0; ydid_sell = FALSE; pcity->was_happy = FALSE; + if (city_is_new) { + update_city_bonuses(pcity); + } + for(y=0; ycity_map[x][y] = C_TILE_EMPTY; diff -Nur -Xfreecivdiff.ignore freeciv-cvs/common/city.c freeciv-patched/common/city.c --- freeciv-cvs/common/city.c 2003-07-24 16:57:16.000000000 +0100 +++ freeciv-patched/common/city.c 2003-07-24 16:59:32.000000000 +0100 @@ -41,8 +41,7 @@ static void citizen_happy_size(struct city *pcity); static void citizen_happy_luxury(struct city *pcity); static void citizen_happy_units(struct city *pcity, int unhap); -static void citizen_happy_buildings(struct city *pcity); -static void citizen_happy_wonders(struct city *pcity); +static void citizen_happy_buildings(struct city *pcity, int wonder); static void unhappy_city_check(struct city *pcity); static void set_pollution(struct city *pcity); static void set_food_trade_shields(struct city *pcity); @@ -1520,23 +1519,7 @@ **************************************************************************/ int get_city_shield_bonus(struct city *pcity) { - int shield_bonus = 100; - - if (city_got_building(pcity, B_FACTORY)) { - shield_bonus += 50; - if (city_got_building(pcity, B_MFG)) { - shield_bonus += 50; - } - - if (city_affected_by_wonder(pcity, B_HOOVER) || - city_got_building(pcity, B_POWER) || - city_got_building(pcity, B_HYDRO) || - city_got_building(pcity, B_NUCLEAR)) { - shield_bonus = 100 + (3 * (shield_bonus - 100)) / 2; - } - } - - return shield_bonus; + return pcity->shield_bonus; } /************************************************************************** @@ -1545,19 +1528,7 @@ **************************************************************************/ int get_city_tax_bonus(struct city *pcity) { - int tax_bonus = 100; - - if (city_got_building(pcity, B_MARKETPLACE)) { - tax_bonus += 50; - if (city_got_building(pcity, B_BANK)) { - tax_bonus += 50; - if (city_got_building(pcity, B_STOCK)) { - tax_bonus += 50; - } - } - } - - return tax_bonus; + return pcity->tax_bonus; } /************************************************************************** @@ -1565,25 +1536,7 @@ **************************************************************************/ static int get_city_tithes_bonus(struct city *pcity) { - int tithes_bonus = 0; - - if (!government_has_flag - (get_gov_pcity(pcity), G_CONVERT_TITHES_TO_MONEY)) { - return 0; - } - - if (city_got_building(pcity, B_TEMPLE)) - tithes_bonus += get_temple_power(pcity); - if (city_got_building(pcity, B_COLOSSEUM)) - tithes_bonus += get_colosseum_power(pcity); - if (city_got_effect(pcity, B_CATHEDRAL)) - tithes_bonus += get_cathedral_power(pcity); - if (city_affected_by_wonder(pcity, B_BACH)) - tithes_bonus += 2; - if (city_affected_by_wonder(pcity, B_CURE)) - tithes_bonus += 1; - - return tithes_bonus; + return pcity->tithes_bonus; } /************************************************************************** @@ -1591,28 +1544,7 @@ **************************************************************************/ int get_city_science_bonus(struct city *pcity) { - int science_bonus = 100; - - if (city_got_building(pcity, B_LIBRARY)) { - science_bonus += 50; - if (city_got_building(pcity, B_UNIVERSITY)) { - science_bonus += 50; - } - if (city_got_effect(pcity, B_RESEARCH)) { - science_bonus += 50; - } - } - if (city_affected_by_wonder(pcity, B_COPERNICUS)) { - science_bonus += 50; - } - if (city_affected_by_wonder(pcity, B_ISAAC)) { - science_bonus += 100; - } - if (government_has_flag(get_gov_pcity(pcity), G_REDUCED_RESEARCH)) { - science_bonus /= 2; - } - - return science_bonus; + return pcity->science_bonus; } /************************************************************************** @@ -1740,11 +1672,6 @@ **************************************************************************/ static void add_buildings_effect(struct city *pcity) { - /* this is the place to set them */ - pcity->tax_bonus = get_city_tax_bonus(pcity); - pcity->science_bonus = get_city_science_bonus(pcity); - pcity->shield_bonus = get_city_shield_bonus(pcity); - pcity->shield_prod = (pcity->shield_prod * pcity->shield_bonus) / 100; pcity->luxury_total = (pcity->luxury_total * pcity->tax_bonus) / 100; pcity->tax_total = (pcity->tax_total * pcity->tax_bonus) / 100; @@ -1753,6 +1680,124 @@ } /************************************************************************** + Updates the various modifiers and bonuses due to city improvements + (should be called whenever city effects change - i.e. by + update_all_effects and friends) +**************************************************************************/ +void update_city_bonuses(struct city *pcity) +{ + int tax_bonus = 100, science_bonus = 100, /* City bonuses */ + shield_bonus = 100, luxury_bonus = 100; + int tax_pct = 100, science_pct = 100, /* City bonus multipliers */ + shield_pct = 100, luxury_pct = 100; + int poppoladj = 100, prodpoladj = 100, /* Pollution adjustments */ + poladj = 100; + int poppolpct = 100, prodpolpct = 100, /* Pollution multipliers */ + polpct = 100; + int makecontent = 0, makehappy = 0, /* Happiness modifiers */ + forcecontent = 0, forcehappy = 0; + int makecontentpct = 100, forcecontentpct = 100; + int makecontentmil = 0, makecontentmilper = 0; + + int amount; + struct player *pplayer; + struct government *gov; + + pplayer = city_owner(pcity); + gov = get_gov_pcity(pcity); + + city_effects_iterate(iter, pcity) { + amount = iter.imeff->amount; + switch(iter.imeff->type) { + case EFT_TAX_BONUS: + tax_bonus += amount; break; + case EFT_TAX_PCT: + tax_pct = tax_pct * amount / 100; break; + case EFT_LUXURY_BONUS: + luxury_bonus += amount; break; + case EFT_LUXURY_PCT: + luxury_pct = luxury_pct * amount / 100; break; + case EFT_SCIENCE_BONUS: + science_bonus += amount; break; + case EFT_SCIENCE_PCT: + science_pct = science_pct * amount / 100; break; + case EFT_PROD_BONUS: + shield_bonus += amount; break; + case EFT_PROD_PCT: + shield_pct = shield_pct * amount / 100; break; + case EFT_POLLU_ADJ: + poladj += amount; break; + case EFT_POLLU_PCT: + polpct = polpct * amount / 100; break; + case EFT_POLLU_POP_ADJ: + poppoladj += amount; break; + case EFT_POLLU_POP_PCT: + poppolpct = poppolpct * amount / 100; break; + case EFT_POLLU_PROD_ADJ: + prodpoladj += amount; break; + case EFT_POLLU_PROD_PCT: + prodpolpct = prodpolpct * amount / 100; break; + case EFT_MAKE_CONTENT_MIL: + makecontentmil += amount; break; + case EFT_MAKE_CONTENT_MIL_PER: + makecontentmilper += amount; break; + case EFT_MAKE_CONTENT: + makecontent += amount; break; + case EFT_MAKE_CONTENT_PCT: + makecontentpct = makecontentpct * amount / 100; break; + case EFT_MAKE_HAPPY: + makehappy += amount; break; + case EFT_FORCE_CONTENT: + forcecontent += amount; break; + case EFT_FORCE_CONTENT_PCT: + forcecontentpct = forcecontentpct * amount / 100; break; + case EFT_FORCE_HAPPY: + forcehappy += amount; break; + default: + break; + } + } city_effects_iterate_end; + + /* Apply the multipliers to the bonuses (such that the bonuses are all + summed first, and only then are the multipliers applied) */ + tax_bonus = tax_bonus * tax_pct / 100; + science_bonus = science_bonus * science_pct / 100; + shield_bonus = shield_bonus * shield_pct / 100; + luxury_bonus = luxury_bonus * luxury_pct / 100; + makecontent = makecontent * makecontentpct / 100; + forcecontent = forcecontent * forcecontentpct / 100; + poladj = poladj * polpct / 100; + poppoladj = poppoladj * poppolpct / 100; + prodpoladj = prodpoladj * prodpolpct / 100; + + /* Tithes are generated from "content-making" buildings - note that + we're choosing to ignore the makecontentpct modifiers here */ + if (government_has_flag(gov, G_CONVERT_TITHES_TO_MONEY)) { + pcity->tithes_bonus = pcity->makecontent + pcity->forcecontent; + } else { + pcity->tithes_bonus = 0; + } + + if (government_has_flag(gov, G_REDUCED_RESEARCH)) { + science_bonus /= 2; + } + + pcity->tax_bonus = tax_bonus; + pcity->science_bonus = science_bonus; + pcity->shield_bonus = shield_bonus; + pcity->shield_prod = pcity->shield_prod * shield_bonus / 100; + pcity->makecontent = makecontent; + pcity->makehappy = makehappy; + pcity->forcecontent = forcecontent; + pcity->forcehappy = forcehappy; + pcity->makecontentmil = makecontentmil; + pcity->makecontentmilper = makecontentmilper; + pcity->poladj = poladj; + pcity->poppoladj = poppoladj; + pcity->prodpoladj = prodpoladj; +} + +/************************************************************************** ... **************************************************************************/ static void happy_copy(struct city *pcity, int i) @@ -1861,94 +1906,55 @@ } /************************************************************************** -... -**************************************************************************/ -static void citizen_happy_buildings(struct city *pcity) -{ - struct government *g = get_gov_pcity(pcity); - int faces = 0; - happy_copy(pcity, 1); - - if (city_got_building(pcity, B_TEMPLE)) { - faces += get_temple_power(pcity); + Apply the effect on our citizens' happiness of normal buildings + (wonder=FALSE) or Wonders (wonder=TRUE); the bonuses used are updated + by update_city_bonuses() +**************************************************************************/ +static void citizen_happy_buildings(struct city *pcity, int wonder) +{ + int hi; /* hi = "Happy Index" */ + int confaces; /* Number of people to make content */ + int hapfaces; /* Number of people to make happy */ + + if (wonder) { + hi = 4; + confaces = pcity->forcecontent; + hapfaces = pcity->forcehappy; + } else { + hi = 2; + confaces = pcity->makecontent; + hapfaces = pcity->makehappy; } - if (city_got_building(pcity, B_COURTHOUSE) && g->corruption_level == 0) { - faces++; + happy_copy(pcity, hi - 1); + + /* hapfaces can make content people happy */ + while (hapfaces > 0 && pcity->ppl_content[hi] > 0) { + pcity->ppl_content[hi]--; + pcity->ppl_happy[hi]++; + hapfaces--; } - if (city_got_building(pcity, B_COLOSSEUM)) - faces += get_colosseum_power(pcity); - if (city_got_effect(pcity, B_CATHEDRAL)) - faces += get_cathedral_power(pcity); - /* make people content (but not happy): + /* If any hapfaces left, have them act as confaces */ + confaces += hapfaces; + + /* confaces make people content (but not happy): get rid of angry first, then make unhappy content. */ - while (faces > 0 && pcity->ppl_angry[2] > 0) { - pcity->ppl_angry[2]--; - pcity->ppl_unhappy[2]++; - faces--; - } - while (faces > 0 && pcity->ppl_unhappy[2] > 0) { - pcity->ppl_unhappy[2]--; - pcity->ppl_content[2]++; - faces--; - } -/* no longer hijacking ppl_content[0]; seems no longer to be helpful -- Syela */ - /* TV doesn't make people happy just content... - - while (faces && pcity->ppl_content[2]) { - pcity->ppl_content[2]--; - pcity->ppl_happy[2]++; - faces--; - } - - */ -} - -/************************************************************************** -... -**************************************************************************/ -static void citizen_happy_wonders(struct city *pcity) -{ - int bonus = 0; - - happy_copy(pcity, 3); - - if (city_affected_by_wonder(pcity, B_HANGING)) { - bonus += 1; - if (city_got_building(pcity, B_HANGING)) - bonus += 2; - while (bonus > 0 && pcity->ppl_content[4] > 0) { - pcity->ppl_content[4]--; - pcity->ppl_happy[4]++; - bonus--; - /* well i'm not sure what to do with the rest, - will let it make unhappy content */ - } - } - if (city_affected_by_wonder(pcity, B_BACH)) - bonus += 2; - if (city_affected_by_wonder(pcity, B_CURE)) - bonus += 1; - /* get rid of angry first, then make unhappy content */ - while (bonus > 0 && pcity->ppl_angry[4] > 0) { - pcity->ppl_angry[4]--; - pcity->ppl_unhappy[4]++; - bonus--; - } - while (bonus > 0 && pcity->ppl_unhappy[4] > 0) { - pcity->ppl_unhappy[4]--; - pcity->ppl_content[4]++; - bonus--; - } - if (city_affected_by_wonder(pcity, B_SHAKESPEARE)) { - pcity->ppl_content[4] += pcity->ppl_unhappy[4] + pcity->ppl_angry[4]; - pcity->ppl_unhappy[4] = 0; - pcity->ppl_angry[4] = 0; - } - if (government_has_flag(get_gov_pcity(pcity), G_NO_UNHAPPY_CITIZENS)) { - pcity->ppl_content[4] += pcity->ppl_unhappy[4] + pcity->ppl_angry[4]; - pcity->ppl_unhappy[4] = 0; - pcity->ppl_angry[4] = 0; + while (confaces > 0 && pcity->ppl_angry[hi] > 0) { + pcity->ppl_angry[hi]--; + pcity->ppl_unhappy[hi]++; + confaces--; + } + while (confaces > 0 && pcity->ppl_unhappy[hi] > 0) { + pcity->ppl_unhappy[hi]--; + pcity->ppl_content[hi]++; + confaces--; + } + + if (wonder + && government_has_flag(get_gov_pcity(pcity), G_NO_UNHAPPY_CITIZENS)) { + pcity->ppl_content[hi] += pcity->ppl_unhappy[hi] + pcity->ppl_angry[hi]; + pcity->ppl_unhappy[hi] = 0; + pcity->ppl_angry[hi] = 0; } } @@ -1965,30 +1971,26 @@ } } - - /************************************************************************** -... + Sets the city's pollution, using the modifiers set by + update_city_bonuses **************************************************************************/ static void set_pollution(struct city *pcity) { + int pol, poppol, prodpol, mod; struct player *pplayer = city_owner(pcity); - pcity->pollution = pcity->shield_prod; - if (city_got_building(pcity, B_RECYCLING)) - pcity->pollution /= 3; - else if (city_got_building(pcity, B_HYDRO) || - city_affected_by_wonder(pcity, B_HOOVER) || - city_got_building(pcity, B_NUCLEAR)) - pcity->pollution /= 2; - - if (!city_got_building(pcity, B_MASS)) { - pcity->pollution += (pcity->size * - num_known_tech_with_flag - (pplayer, TF_POPULATION_POLLUTION_INC)) / 4; - } + mod = player_knows_techs_with_flag(pplayer, TF_POPULATION_POLLUTION_INC); + prodpol = pcity->shield_prod; + poppol = pcity->size * mod / 4; + + prodpol = prodpol * pcity->prodpoladj / 100; + poppol = poppol * pcity->poppoladj / 100; + + pol = prodpol + poppol; + pol = pol * pcity->poladj / 100; - pcity->pollution = MAX(0, pcity->pollution - 20); + pcity->pollution = MAX(0, pol - 20); } /************************************************************************** @@ -2036,7 +2038,7 @@ } /************************************************************************** -... + Evaluate the cost of supporting units, martial law and aggressive units **************************************************************************/ static void city_support(struct city *pcity, void (*send_unit_info) (struct player *pplayer, @@ -2044,18 +2046,14 @@ { struct government *g = get_gov_pcity(pcity); - bool have_police = city_got_effect(pcity, B_POLICE); - int variant = improvement_variant(B_WOMENS); - int free_happy = citygov_free_happy(pcity, g); int free_shield = citygov_free_shield(pcity, g); int free_food = citygov_free_food(pcity, g); int free_gold = citygov_free_gold(pcity, g); - if (variant == 0 && have_police) { - /* ?? This does the right thing for normal Republic and Democ -- dwp */ - free_happy += g->unit_happy_cost_factor; - } + /* Add total exemption from unhappiness from aggressive + * units, makecontentmil (e.g. from Police Station) */ + free_happy += pcity->makecontentmil; happy_copy(pcity, 2); @@ -2127,9 +2125,10 @@ happy_cost = 0; } } - if (happy_cost > 0 && variant == 1 && have_police) { - happy_cost--; - } + + /* Per-unit modifier (effect of, e.g., Civ2's Police Station) */ + if (happy_cost <= pcity->makecontentmilper) happy_cost=0; + else happy_cost -= pcity->makecontentmilper; /* subtract values found above from city's resources -- SKi */ if (happy_cost > 0) { @@ -2189,9 +2188,16 @@ add_buildings_effect(pcity); /* marketplace, library wonders.. */ set_pollution(pcity); citizen_happy_luxury(pcity); /* with our new found luxuries */ - citizen_happy_buildings(pcity); /* temple cathedral colosseum */ - city_support(pcity, send_unit_info); /* manage settlers, and units */ - citizen_happy_wonders(pcity); /* happy wonders & fundamentalism */ + + /* Happy buildings - e.g. temple cathedral colosseum */ + citizen_happy_buildings(pcity, FALSE); + + /* manage settlers, and units */ + city_support(pcity, send_unit_info); + + /* Happy Wonders (& Fundamentalism) */ + citizen_happy_buildings(pcity, TRUE); + unhappy_city_check(pcity); if (refresh_trade_route_cities && pcity->tile_trade != prev_tile_trade) { diff -Nur -Xfreecivdiff.ignore freeciv-cvs/common/city.h freeciv-patched/common/city.h --- freeciv-cvs/common/city.h 2003-07-24 16:57:16.000000000 +0100 +++ freeciv-patched/common/city.h 2003-07-24 16:59:32.000000000 +0100 @@ -233,6 +233,14 @@ int shield_prod, shield_surplus, shield_waste; int trade_prod, corruption, tile_trade; int shield_bonus, tax_bonus, science_bonus; /* more CPU savings! */ + int tithes_bonus; + + /* happiness modifiers from city improvements */ + int makecontent, makehappy, forcecontent, forcehappy; + int makecontentmil, makecontentmilper; + + /* pollution modifiers from city improvements */ + int poppoladj, prodpoladj, poladj; /* the totals */ int luxury_total, tax_total, science_total; @@ -451,6 +459,7 @@ void city_remove_improvement(struct city *pcity,Impr_Type_id impr); /* city update functions */ +void update_city_bonuses(struct city *pcity); void generic_city_refresh(struct city *pcity, bool refresh_trade_route_cities, void (*send_unit_info) (struct player * pplayer, diff -Nur -Xfreecivdiff.ignore freeciv-cvs/common/game.c freeciv-patched/common/game.c --- freeciv-cvs/common/game.c 2003-07-24 16:57:16.000000000 +0100 +++ freeciv-patched/common/game.c 2003-07-24 16:59:32.000000000 +0100 @@ -703,4 +703,10 @@ } city_list_iterate_end; } players_iterate_end; } while (changed && cond_eff); + + players_iterate(pplayer) { + city_list_iterate(pplayer->cities, pcity) { + update_city_bonuses(pcity); + } city_list_iterate_end; + } players_iterate_end; } diff -Nur -Xfreecivdiff.ignore freeciv-cvs/common/improvement.c freeciv-patched/common/improvement.c --- freeciv-cvs/common/improvement.c 2003-07-24 16:58:28.000000000 +0100 +++ freeciv-patched/common/improvement.c 2003-07-24 16:59:32.000000000 +0100 @@ -103,21 +103,21 @@ "No_Sink_Deep", "Nuke_Proof", "Pollu_Adj", - "Pollu_Adj_Pop", - "Pollu_Adj_Prod", - "Pollu_Set", - "Pollu_Set_Pop", - "Pollu_Set_Prod", + "Pollu_Pop_Adj", + "Pollu_Prod_Adj", + "Pollu_Pct", + "Pollu_Pop_Pct", + "Pollu_Prod_Pct", "Prod_Add_Tile", "Prod_Bonus", "Prod_Inc_Tile", "Prod_Per_Tile", "Prod_To_Gold", - "Reduce_Corrupt", - "Reduce_Waste", + "Corrupt_Adj", + "Corrupt_Pct", "Reveal_Cities", "Reveal_Map", - "Revolt_Dist", + "Revolt_Dist_Adj", "Science_Bonus", "Science_Pct", "Size_Unlimit", @@ -144,7 +144,15 @@ "Upgrade_One_Leap", "Upgrade_All_Step", "Upgrade_All_Leap", - "Upkeep_Free" + "Upkeep_Free", + "Food_Pct", + "Prod_Pct", + "Revolt_Dist_Pct", + "Trade_Pct", + "Make_Content_Mil_Per", + "Force_Content", + "Force_Content_Pct", + "Force_Happy" }; /************************************************************************** diff -Nur -Xfreecivdiff.ignore freeciv-cvs/common/improvement.h freeciv-patched/common/improvement.h --- freeciv-cvs/common/improvement.h 2003-07-24 16:58:28.000000000 +0100 +++ freeciv-patched/common/improvement.h 2003-07-24 16:59:32.000000000 +0100 @@ -122,21 +122,21 @@ EFT_NO_SINK_DEEP, EFT_NUKE_PROOF, EFT_POLLU_ADJ, - EFT_POLLU_ADJ_POP, - EFT_POLLU_ADJ_PROD, - EFT_POLLU_SET, - EFT_POLLU_SET_POP, - EFT_POLLU_SET_PROD, + EFT_POLLU_POP_ADJ, + EFT_POLLU_PROD_ADJ, + EFT_POLLU_PCT, + EFT_POLLU_POP_PCT, + EFT_POLLU_PROD_PCT, EFT_PROD_ADD_TILE, EFT_PROD_BONUS, EFT_PROD_INC_TILE, EFT_PROD_PER_TILE, EFT_PROD_TO_GOLD, - EFT_REDUCE_CORRUPT, - EFT_REDUCE_WASTE, + EFT_CORRUPT_ADJ, + EFT_CORRUPT_PCT, EFT_REVEAL_CITIES, EFT_REVEAL_MAP, - EFT_REVOLT_DIST, + EFT_REVOLT_DIST_ADJ, EFT_SCIENCE_BONUS, EFT_SCIENCE_PCT, EFT_SIZE_UNLIMIT, @@ -164,6 +164,14 @@ EFT_UPGRADE_ALL_STEP, EFT_UPGRADE_ALL_LEAP, EFT_UPKEEP_FREE, + EFT_FOOD_PCT, + EFT_PROD_PCT, + EFT_REVOLT_DIST_PCT, + EFT_TRADE_PCT, + EFT_MAKE_CONTENT_MIL_PER, + EFT_FORCE_CONTENT, + EFT_FORCE_CONTENT_PCT, + EFT_FORCE_HAPPY, EFT_LAST /* keep this last */ }; diff -Nur -Xfreecivdiff.ignore freeciv-cvs/data/civ1/buildings.ruleset freeciv-patched/data/civ1/buildings.ruleset --- freeciv-cvs/data/civ1/buildings.ruleset 2003-07-18 13:40:03.000000000 +0100 +++ freeciv-patched/data/civ1/buildings.ruleset 2003-07-24 16:59:32.000000000 +0100 @@ -367,9 +367,9 @@ sabotage = 100 effect = { "type", "range", "amount", "cond_gov" - "Reduce_Corrupt", "City", 50 + "Corrupt_Adj", "City", -50 "Make_Content", "City", 1, "Democracy" - "Revolt_Dist", "City", 50 + "Revolt_Dist_Adj", "City", -50 } sound = "b_courthouse" sound_alt = "b_generic" @@ -484,8 +484,8 @@ effect = { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "City", 50, "Factory" - "Pollu_Adj_Prod", "City", 50 - "Pollu_Adj_Prod", "City", -50, "Recycling Center" + "Pollu_Prod_Adj", "City", -50 + "Pollu_Prod_Adj", "City", 50, "Recycling Center" } sound = "b_hydro_plant" sound_alt = "b_generic" @@ -575,7 +575,7 @@ sabotage = 100 effect = { "type", "range", "amount" - "Pollu_Set_Pop", "City", 0 + "Pollu_Pop_Pct", "City", 0 } sound = "b_mass_transit" sound_alt = "b_generic" @@ -632,8 +632,8 @@ effect = { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "City", 50, "Factory" - "Pollu_Adj_Prod", "City", 50 - "Pollu_Adj_Prod", "City", -50, "Recycling Center" + "Pollu_Prod_Adj", "City", -50 + "Pollu_Prod_Adj", "City", 50, "Recycling Center" } sound = "b_nuclear_plant" sound_alt = "b_generic" @@ -825,7 +825,7 @@ sabotage = 100 effect = { "type", "range", "amount" - "Pollu_Adj_Prod", "City", 34 + "Pollu_Prod_Adj", "City", -66 } sound = "b_recycling_center" sound_alt = "b_generic" @@ -969,7 +969,7 @@ effect = { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "City", 50, "Factory" - "Pollu_Set_Prod", "City", 0 + "Pollu_Prod_Pct", "City", 0 "Slow_Global_Warm", "World", 10 } sound = "b_solar_plant" @@ -1361,7 +1361,7 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Happy", "Player", 1 + "Force_Happy", "Player", 1 } sound = "w_cure_for_cancer" sound_alt = "w_generic" @@ -1503,8 +1503,8 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Happy", "Player", 1 - "Make_Happy", "City", 2 + "Force_Happy", "Player", 1 + "Force_Happy", "City", 2 } sound = "w_hanging_gardens" sound_alt = "w_generic" @@ -1535,8 +1535,8 @@ effect = { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "Island", 50, "Factory" - "Pollu_Adj_Prod", "Island", 50 - "Pollu_Adj_Prod", "Island", -50, "Recycling Center" + "Pollu_Prod_Adj", "Island", -50 + "Pollu_Prod_Adj", "Island", 50, "Recycling Center" } variant = 1 ; FIXME: remove when gen-impr obsoletes sound = "w_hoover_dam" @@ -1593,7 +1593,7 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Content", "Island", 2 + "Force_Content", "Island", 2 } variant = 1 ; FIXME: remove when gen-impr obsoletes sound = "w_js_bachs_cathedral" @@ -1895,7 +1895,7 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Content", "City", 99 + "Force_Content", "City", 99 } sound = "w_shakespeares_theatre" sound_alt = "w_generic" @@ -2013,8 +2013,9 @@ upkeep = 0 sabotage = 0 effect = - { "type", "range", "amount" - "Make_Content_Mil", "Player", 1 + { "type", "range", "amount", "cond_gov" + "Make_Content_Mil_Per", "Player", 1, "Republic" + "Make_Content_Mil_Per", "Player", 1, "Democracy" } variant = 1 ; FIXME: remove when gen-impr obsoletes sound = "w_womens_suffrage" diff -Nur -Xfreecivdiff.ignore freeciv-cvs/data/civ2/buildings.ruleset freeciv-patched/data/civ2/buildings.ruleset --- freeciv-cvs/data/civ2/buildings.ruleset 2003-07-18 13:40:03.000000000 +0100 +++ freeciv-patched/data/civ2/buildings.ruleset 2003-07-24 16:59:32.000000000 +0100 @@ -350,9 +350,9 @@ sabotage = 100 effect = { "type", "range", "amount", "cond_gov" - "Reduce_Corrupt", "City", 50 + "Corrupt_Adj", "City", -50 "Make_Content", "City", 1, "Democracy" - "Revolt_Dist", "City", 50 + "Revolt_Dist_Adj", "City", -50 } sound = "b_courthouse" sound_alt = "b_generic" @@ -467,8 +467,8 @@ effect = { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "City", 50, "Factory" - "Pollu_Adj_Prod", "City", 50 - "Pollu_Adj_Prod", "City", -50, "Recycling Center" + "Pollu_Prod_Adj", "City", -50 + "Pollu_Prod_Adj", "City", 50, "Recycling Center" } sound = "b_hydro_plant" sound_alt = "b_generic" @@ -560,7 +560,7 @@ sabotage = 100 effect = { "type", "range", "amount" - "Pollu_Set_Pop", "City", 0 + "Pollu_Pop_Pct", "City", 0 } sound = "b_mass_transit" sound_alt = "b_generic" @@ -617,8 +617,8 @@ effect = { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "City", 50, "Factory" - "Pollu_Adj_Prod", "City", 50 - "Pollu_Adj_Prod", "City", -50, "Recycling Center" + "Pollu_Prod_Adj", "City", -50 + "Pollu_Prod_Adj", "City", 50, "Recycling Center" } sound = "b_nuclear_plant" sound_alt = "b_generic" @@ -713,7 +713,7 @@ ;spec_gate = equiv_range = "City" ;equiv_dupl = -;equiv_repl = +equiv_repl = "Women's Suffrage" obsolete_by = "None" is_wonder = 0 build_cost = 60 @@ -722,14 +722,14 @@ effect = { "type", "range", "amount", "cond_gov" "Make_Content_Mil", "City", 1, "Republic" - "Make_Content_Mil", "City", 2, "Democracy" + "Make_Content_Mil", "City", 1, "Democracy" } sound = "b_police_station" sound_alt = "b_generic" helptext = _("\ Reduces the unhappiness caused by military units outside the city\ - by 2 under Democracy and 1 under Republic. This improvement has no\ - effect under other governments.\ + by one, under Democracy and Republic. This improvement has no effect\ + under other governments.\ ") [building_port_facility] @@ -813,7 +813,7 @@ sabotage = 100 effect = { "type", "range", "amount" - "Pollu_Adj_Prod", "City", 34 + "Pollu_Prod_Adj", "City", -66 } sound = "b_recycling_center" sound_alt = "b_generic" @@ -960,7 +960,7 @@ effect = { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "City", 50, "Factory" - "Pollu_Set_Prod", "City", 0 + "Pollu_Prod_Pct", "City", 0 "Slow_Global_Warm", "World", 10 } sound = "b_solar_plant" @@ -1354,7 +1354,7 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Happy", "Player", 1 + "Force_Happy", "Player", 1 } sound = "w_cure_for_cancer" sound_alt = "w_generic" @@ -1496,8 +1496,8 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Happy", "Player", 1 - "Make_Happy", "City", 2 + "Force_Happy", "Player", 1 + "Force_Happy", "City", 2 } sound = "w_hanging_gardens" sound_alt = "w_generic" @@ -1528,8 +1528,8 @@ effect = { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "Player", 50, "Factory" - "Pollu_Adj_Prod", "Player", 50 - "Pollu_Adj_Prod", "Player", -50, "Recycling Center" + "Pollu_Prod_Adj", "Player", -50 + "Pollu_Prod_Adj", "Player", 50, "Recycling Center" } sound = "w_hoover_dam" sound_alt = "w_generic" @@ -1583,7 +1583,7 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Content", "Player", 2 + "Force_Content", "Player", 2 } sound = "w_js_bachs_cathedral" sound_alt = "w_generic" @@ -1882,7 +1882,7 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Content", "City", 99 + "Force_Content", "City", 99 } sound = "w_shakespeares_theatre" sound_alt = "w_generic" @@ -2005,15 +2005,14 @@ effect = { "type", "range", "amount", "cond_gov" "Make_Content_Mil", "Player", 1, "Republic" - "Make_Content_Mil", "Player", 2, "Democracy" + "Make_Content_Mil", "Player", 1, "Democracy" } sound = "w_womens_suffrage" sound_alt = "w_generic" helptext = _("\ Counts as a Police Station in every city. (That is, for each city,\ - reduces unhappiness for military units outside the city by 2 under\ - Democracy and 1 under Republic. This wonder has no effect under\ - other governments.)\ + reduces the unhappiness caused by military units outside the city\ + by one, under Democracy and Republic.)\ ") [building_capitalization] diff -Nur -Xfreecivdiff.ignore freeciv-cvs/data/default/buildings.ruleset freeciv-patched/data/default/buildings.ruleset --- freeciv-cvs/data/default/buildings.ruleset 2003-07-10 11:53:40.000000000 +0100 +++ freeciv-patched/data/default/buildings.ruleset 2003-07-24 16:59:32.000000000 +0100 @@ -399,9 +399,9 @@ sabotage = 100 effect = { "type", "range", "amount", "cond_gov" - "Reduce_Corrupt", "City", 50 + "Corrupt_Adj", "City", -50 "Make_Content", "City", 1, "Democracy" - "Revolt_Dist", "City", 50 + "Revolt_Dist_Adj", "City", -50 } sound = "b_courthouse" sound_alt = "b_generic" @@ -517,8 +517,8 @@ { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "City", 25, "Factory" "Prod_Bonus", "City", 25, "Mfg. Plant" - "Pollu_Adj_Prod", "City", 50 - "Pollu_Adj_Prod", "City", -50, "Recycling Center" + "Pollu_Prod_Adj", "City", -50 + "Pollu_Prod_Adj", "City", 50, "Recycling Center" } sound = "b_hydro_plant" sound_alt = "b_generic" @@ -613,7 +613,7 @@ sabotage = 100 effect = { "type", "range", "amount" - "Pollu_Set_Pop", "City", 0 + "Pollu_Pop_Pct", "City", 0 } sound = "b_mass_transit" sound_alt = "b_generic" @@ -671,8 +671,8 @@ { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "City", 25, "Factory" "Prod_Bonus", "City", 25, "Mfg. Plant" - "Pollu_Adj_Prod", "City", 50 - "Pollu_Adj_Prod", "City", -50, "Recycling Center" + "Pollu_Prod_Adj", "City", -50 + "Pollu_Prod_Adj", "City", 50, "Recycling Center" } sound = "b_nuclear_plant" sound_alt = "b_generic" @@ -769,7 +769,7 @@ ;spec_gate = equiv_range = "City" ;equiv_dupl = -;equiv_repl = +equiv_repl = "Women's Suffrage" obsolete_by = "None" is_wonder = 0 build_cost = 60 @@ -787,9 +787,6 @@ by 2 under Democracy and 1 under Republic. This improvement has no\ effect under other governments.\ ") -; NOTE: -; For Civ2 this should reduce unhappiness by one for *each* unit -; outside a city that is causing at least one unhappiness. [building_port_facility] name = _("Port Facility") @@ -876,7 +873,7 @@ sabotage = 100 effect = { "type", "range", "amount" - "Pollu_Adj_Prod", "City", 34 + "Pollu_Prod_Adj", "City", -66 } sound = "b_recycling_center" sound_alt = "b_generic" @@ -1024,7 +1021,7 @@ { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "City", 25, "Factory" "Prod_Bonus", "City", 25, "Mfg. Plant" - "Pollu_Set_Prod", "City", 0 + "Pollu_Prod_Pct", "City", 0 "Slow_Global_Warm", "World", 10 } sound = "b_solar_plant" @@ -1422,7 +1419,7 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Content", "Player", 1 + "Force_Content", "Player", 1 } sound = "w_cure_for_cancer" sound_alt = "w_generic" @@ -1566,8 +1563,8 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Happy", "Player", 1 - "Make_Happy", "City", 2 + "Force_Happy", "Player", 1 + "Force_Happy", "City", 2 } sound = "w_hanging_gardens" sound_alt = "w_generic" @@ -1599,8 +1596,8 @@ { "type", "range", "amount", "cond_bldg" "Prod_Bonus", "Player", 25, "Factory" "Prod_Bonus", "Player", 25, "Mfg. Plant" - "Pollu_Adj_Prod", "Player", 50 - "Pollu_Adj_Prod", "Player", -50, "Recycling Center" + "Pollu_Prod_Adj", "Player", -50 + "Pollu_Prod_Adj", "Player", 50, "Recycling Center" } sound = "w_hoover_dam" sound_alt = "w_generic" @@ -1654,7 +1651,7 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Content", "Player", 2 + "Force_Content", "Player", 2 } sound = "w_js_bachs_cathedral" sound_alt = "w_generic" @@ -1953,7 +1950,7 @@ sabotage = 0 effect = { "type", "range", "amount" - "Make_Content", "City", 99 + "Force_Content", "City", 99 } sound = "w_shakespeares_theatre" sound_alt = "w_generic" diff -Nur -Xfreecivdiff.ignore freeciv-cvs/doc/README.effects freeciv-patched/doc/README.effects --- freeciv-cvs/doc/README.effects 2003-07-24 16:58:29.000000000 +0100 +++ freeciv-patched/doc/README.effects 2003-07-24 16:59:32.000000000 +0100 @@ -39,6 +39,10 @@ "Food_Bonus" - food production is increased by AMOUNT percent (all Food_Bonus' are summed before being applied) +"Food_Pct" - multiplies total food production by AMOUNT percent + (applied after Food_Bonus; multiple effects are + multiplicative) + "Food_Inc_Tile" - each worked tile that is already producing some food produces AMOUNT additional food @@ -57,16 +61,35 @@ "Luxury_Bonus" - luxury production increased by AMOUNT percent (all Luxury_Bonus' are summed before being applied) -"Luxury_Pct" - increases luxury production by AMOUNT percent - -"Make_Content" - makes AMOUNT unhappy citizens content +"Luxury_Pct" - multiplies luxury production by AMOUNT percent + (applied after Luxury_Bonus; multiple effects + are multiplicative) -"Make_Content_Mil"- makes AMOUNT per unit of unhappy citizens caused +"Make_Content_Mil"- makes AMOUNT unhappy citizens caused by units outside of a city content -"Make_Content_Pct"- increase "Make_Content" by AMOUNT percent +"Make_Content_Mil_Per"- makes AMOUNT _per unit_ of unhappy citizens + caused by units outside of a city content + +"Make_Content" - makes AMOUNT unhappy citizens content + (applied *before* martial law and aggressive units; + all Make_Content's are summed before being applied) + +"Make_Content_Pct"- multiplies total "Make_Content" by AMOUNT percent + (multiple effects are multiplicative) "Make_Happy" - makes AMOUNT content citizens happy + (all Make_Happy's are summed before being applied) + +"Force_Content" - makes AMOUNT unhappy citizens content + (applied *after* martial law and aggressive units; + all Force_Content's are summed before being applied) + +"Force_Content_Pct"- increase total "Force_Content" by AMOUNT percent + (multiple effects are multiplicative) + +"Force_Happy" - makes AMOUNT content citizens happy + (all Force_Happy's are summed before being applied) "May_Declare_War"- allowed to declare war at least AMOUNT percent of the time @@ -77,27 +100,28 @@ "Nuke_Proof" - nuclear attacks will fail within AMOUNT distance -"Pollu_Adj" - multiplies pollution by AMOUNT percent +"Pollu_Adj" - pollution is increased by AMOUNT percent (all Pollu_Adj's are summed before being applied) -"Pollu_Adj_Pop" - multiplies pollution caused by population by AMOUNT - percent - (all Pollu_Adj_Pop's are summed before being applied) - -"Pollu_Adj_Prod"- multiplies pollution caused by shield production by - AMOUNT percent - (all Pollu_Adj_Prod's are summed before being applied) - -"Pollu_Set" - sets pollution to AMOUNT; override all other effects - (all Pollu_Set's are summed before being applied) - -"Pollu_Set_Pop" - sets pollution caused by population to AMOUNT; - override all other effects - (all Pollu_Set_Pop's are summed before being applied) - -"Pollu_Set_Prod"- sets pollution caused by shield production to AMOUNT; - override all other effects - (all Pollu_Set_Prod's are summed before being applied) +"Pollu_Pct" - multiplies pollution by AMOUNT percent + (applied after Pollu_Adj; multiple effects + are multiplicative) + +"Pollu_Pop_Adj" - pollution caused by population is increased by + AMOUNT percent (all Pollu_Pop_Adj's are summed + before being applied) + +"Pollu_Pop_Pct" - multiplies pollution caused by population by + AMOUNT percent (applied after Pollu_Pop_Adj; + multiple effects are multiplicative) + +"Pollu_Prod_Adj"- pollution caused by shield production is increased by + AMOUNT percent (all Pollu_Prod_Adj's are summed + before being applied) + +"Pollu_Prod_Pct"- multiplies pollution caused by shield production by + AMOUNT percent (applied after Pollu_Prod_Adj; + multiple effects are multiplicative) "Prod_Add_Tile" - each worked tile produces AMOUNT additional shield production @@ -105,6 +129,10 @@ "Prod_Bonus" - shield production is increased by AMOUNT percent (all Prod_Bonus' are summed before being applied) +"Prod_Pct" - multiplies total shield production by AMOUNT percent + (applied after Prod_Bonus; multiple effects are + multiplicative) + "Prod_Inc_Tile" - each worked tile that is already producing some shields produces AMOUNT additional shields @@ -113,21 +141,32 @@ "Prod_To_Gold" - convert production to gold at AMOUNT percent rate -"Reduce_Corrupt"- reduces corruption by AMOUNT percent +"Corrupt_Adj" - corruption is increased by AMOUNT percent + (all Corrupt_Adj's are summed before being applied) -"Reduce_Waste" - reduces waste by AMOUNT percent +"Corrupt_Pct" - multiplies total corruption by AMOUNT percent + (applied after Corrupt_Adj; multiple effects are + multiplicative) "Reveal_Cities" - make all city tiles known "Reveal_Map" - make entire map known -"Revolt_Dist" - multiplies effective distance to the capital by +"Revolt_Dist_Adj"- effective distance to the capital is increased by + AMOUNT percent for purpose of computing revolt cost + (all Revolt_Dist_Adj's are summed before being applied) + +"Revolt_Dist_Pct"- multiplies effective distance to the capital by AMOUNT percent for purpose of computing revolt cost + (applied after Revolt_Dist_Adj; multiple effects are + multiplicative) "Science_Bonus" - science research is increased by AMOUNT percent (all Science_Bonus' are summed before being applied) -"Science_Pct" - increases science research by AMOUNT percent +"Science_Pct" - multiplies total science by AMOUNT percent + (applied after Science_Bonus; multiple effects are + multiplicative) "Size_Unlimit" - cities not affected will not grow beyond AMOUNT @@ -150,13 +189,19 @@ "Tax_Bonus" - tax revenues are increased by AMOUNT percent (all Tax_Bonus' are summed before being applied) -"Tax_Pct" - increases tax revenues by AMOUNT percent +"Tax_Pct" - multiplies total tax by AMOUNT percent + (applied after Tax_Bonus; multiple effects are + multiplicative) "Trade_Add_Tile"- each worked tile produces AMOUNT additional trade "Trade_Bonus" - trade generated is increased by AMOUNT percent (all Trade_Bonus' are summed before being applied) +"Trade_Pct" - multiplies total trade by AMOUNT percent + (applied after Trade_Bonus; multiple effects are + multiplicative) + "Trade_Inc_Tile"- each worked tile that is already producing some trade produces AMOUNT additional trade diff -Nur -Xfreecivdiff.ignore freeciv-cvs/server/citytools.c freeciv-patched/server/citytools.c --- freeciv-cvs/server/citytools.c 2003-07-24 16:57:16.000000000 +0100 +++ freeciv-patched/server/citytools.c 2003-07-24 16:59:32.000000000 +0100 @@ -1000,6 +1000,8 @@ /* Update the national borders. */ map_update_borders_city_change(pcity); + update_city_bonuses(pcity); + /* it is possible to build a city on a tile that is already worked * this will displace the worker on the newly-built city's tile -- Syela */ for (y_itr = 0; y_itr < CITY_MAP_SIZE; y_itr++) { diff -Nur -Xfreecivdiff.ignore freeciv-cvs/server/savegame.c freeciv-patched/server/savegame.c --- freeciv-cvs/server/savegame.c 2003-07-24 16:57:16.000000000 +0100 +++ freeciv-patched/server/savegame.c 2003-07-24 16:59:32.000000000 +0100 @@ -895,6 +895,16 @@ unit_list_init(&pcity->units_supported); + /* Initialise list of improvements with City- and Building-wide + equiv_ranges */ + improvement_status_init(pcity->improvements, + ARRAY_SIZE(pcity->improvements)); + + /* Initialise city's vector of improvement effects. */ + ceff_vector_init(&pcity->effects); + + update_city_bonuses(pcity); + /* Initialize pcity->city_map[][], using set_worker_city() so that ptile->worked gets initialized correctly. The pre-initialisation to C_TILE_EMPTY is necessary because set_worker_city() accesses @@ -943,14 +953,6 @@ p=secfile_lookup_str(file, "player%d.c%d.improvements", plrno, i); - /* Initialise list of improvements with City- and Building-wide - equiv_ranges */ - improvement_status_init(pcity->improvements, - ARRAY_SIZE(pcity->improvements)); - - /* Initialise city's vector of improvement effects. */ - ceff_vector_init(&pcity->effects); - impr_type_iterate(x) { if (*p != '\0' && *p++=='1') { city_add_improvement(pcity,x);