From 6dd9dfc071ae2a57a064d5ba2c36ac8cd5d0ef56 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 3 May 2024 17:18:18 +0300 Subject: [PATCH 33/33] Unhardcode Output_Penalty_Tile celebration handling Celebration no longer prevents Output_Penalty_Tile from taking an effect in a hardcoded manner. It's implemented in the ruleset instead. Requested by ddeanbrown See osdn #45236 Signed-off-by: Marko Lindqvist --- common/city.c | 2 +- data/civ1/effects.ruleset | 10 ++++--- data/civ2/effects.ruleset | 10 ++++--- data/civ2civ3/effects.ruleset | 45 ++++++++++++++++-------------- data/classic/effects.ruleset | 10 ++++--- data/goldkeep/effects.ruleset | 10 ++++--- data/multiplayer/effects.ruleset | 10 ++++--- data/sandbox/effects.ruleset | 45 ++++++++++++++++-------------- data/webperimental/effects.ruleset | 10 ++++--- doc/README.effects | 3 +- server/rscompat.c | 5 ++++ 11 files changed, 91 insertions(+), 69 deletions(-) diff --git a/common/city.c b/common/city.c index 22d1673c46..e969005c72 100644 --- a/common/city.c +++ b/common/city.c @@ -1346,7 +1346,7 @@ int city_tile_output(const struct city *pcity, const struct tile *ptile, * get_tile_output_bonus(pcity, ptile, output, EFT_OUTPUT_PER_TILE)) / 100; - if (!is_celebrating && penalty_limit > 0 && prod > penalty_limit) { + if (penalty_limit > 0 && prod > penalty_limit) { if (prod <= game.info.granularity) { prod = 0; } else { diff --git a/data/civ1/effects.ruleset b/data/civ1/effects.ruleset index ad5f4823c5..5e18d25739 100644 --- a/data/civ1/effects.ruleset +++ b/data/civ1/effects.ruleset @@ -57,16 +57,18 @@ value = 4 type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Anarchy", "Player" + { "type", "name", "range", "present" + "Gov", "Anarchy", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_1] type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Despotism", "Player" + { "type", "name", "range", "present" + "Gov", "Despotism", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_2] diff --git a/data/civ2/effects.ruleset b/data/civ2/effects.ruleset index 5e7fc6af1d..5344bb70e1 100644 --- a/data/civ2/effects.ruleset +++ b/data/civ2/effects.ruleset @@ -100,16 +100,18 @@ value = 4 type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Anarchy", "Player" + { "type", "name", "range", "present" + "Gov", "Anarchy", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_1] type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Despotism", "Player" + { "type", "name", "range", "present" + "Gov", "Despotism", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_2] diff --git a/data/civ2civ3/effects.ruleset b/data/civ2civ3/effects.ruleset index 66779be8a3..0c39522e36 100644 --- a/data/civ2civ3/effects.ruleset +++ b/data/civ2civ3/effects.ruleset @@ -1459,39 +1459,42 @@ reqs = type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range", "present", "quiet" - "Gov", "Anarchy", "Player", TRUE, TRUE - "Building", "Pyramids", "Player", FALSE, FALSE - "Tech", "Railroad", "Player", FALSE, FALSE - "OutputType", "Gold", "Local", FALSE, TRUE - "OutputType", "Luxury", "Local", FALSE, TRUE - "OutputType", "Science", "Local", FALSE, TRUE + { "type", "name", "range", "present", "quiet" + "Gov", "Anarchy", "Player", TRUE, TRUE + "Building", "Pyramids", "Player", FALSE, FALSE + "Tech", "Railroad", "Player", FALSE, FALSE + "OutputType", "Gold", "Local", FALSE, TRUE + "OutputType", "Luxury", "Local", FALSE, TRUE + "OutputType", "Science", "Local", FALSE, TRUE + "CityStatus", "Celebrating", "City", FALSE, FALSE } [effect_gov_tile_penalty_tribal] type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range", "present", "quiet" - "Gov", "Tribal", "Player", TRUE, TRUE - "Building", "Pyramids", "Player", FALSE, FALSE - "Tech", "Railroad", "Player", FALSE, FALSE - "OutputType", "Gold", "Local", FALSE, TRUE - "OutputType", "Luxury", "Local", FALSE, TRUE - "OutputType", "Science", "Local", FALSE, TRUE + { "type", "name", "range", "present", "quiet" + "Gov", "Tribal", "Player", TRUE, TRUE + "Building", "Pyramids", "Player", FALSE, FALSE + "Tech", "Railroad", "Player", FALSE, FALSE + "OutputType", "Gold", "Local", FALSE, TRUE + "OutputType", "Luxury", "Local", FALSE, TRUE + "OutputType", "Science", "Local", FALSE, TRUE + "CityStatus", "Celebrating", "City", FALSE, FALSE } [effect_gov_tile_penalty_despotism] type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range", "present", "quiet" - "Gov", "Despotism", "Player", TRUE, TRUE - "Building", "Pyramids", "Player", FALSE, FALSE - "Tech", "Railroad", "Player", FALSE, FALSE - "OutputType", "Gold", "Local", FALSE, TRUE - "OutputType", "Luxury", "Local", FALSE, TRUE - "OutputType", "Science", "Local", FALSE, TRUE + { "type", "name", "range", "present", "quiet" + "Gov", "Despotism", "Player", TRUE, TRUE + "Building", "Pyramids", "Player", FALSE, FALSE + "Tech", "Railroad", "Player", FALSE, FALSE + "OutputType", "Gold", "Local", FALSE, TRUE + "OutputType", "Luxury", "Local", FALSE, TRUE + "OutputType", "Science", "Local", FALSE, TRUE + "CityStatus", "Celebrating", "City", FALSE, FALSE } [effect_gov_tile_bonus_republic] diff --git a/data/classic/effects.ruleset b/data/classic/effects.ruleset index 3af6e72988..9e3c482233 100644 --- a/data/classic/effects.ruleset +++ b/data/classic/effects.ruleset @@ -683,16 +683,18 @@ reqs = type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Anarchy", "Player" + { "type", "name", "range", "present" + "Gov", "Anarchy", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_1] type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Despotism", "Player" + { "type", "name", "range", "present" + "Gov", "Despotism", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_2] diff --git a/data/goldkeep/effects.ruleset b/data/goldkeep/effects.ruleset index defedda325..979fadbb7e 100644 --- a/data/goldkeep/effects.ruleset +++ b/data/goldkeep/effects.ruleset @@ -770,16 +770,18 @@ reqs = type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Anarchy", "Player" + { "type", "name", "range", "present" + "Gov", "Anarchy", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_1] type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Despotism", "Player" + { "type", "name", "range", "present" + "Gov", "Despotism", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_2] diff --git a/data/multiplayer/effects.ruleset b/data/multiplayer/effects.ruleset index 5bb2529b46..035e6ca196 100644 --- a/data/multiplayer/effects.ruleset +++ b/data/multiplayer/effects.ruleset @@ -679,16 +679,18 @@ reqs = type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Anarchy", "Player" + { "type", "name", "range", "present" + "Gov", "Anarchy", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_1] type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Despotism", "Player" + { "type", "name", "range", "present" + "Gov", "Despotism", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_2] diff --git a/data/sandbox/effects.ruleset b/data/sandbox/effects.ruleset index 24f0b45cc1..4eeb87ced7 100644 --- a/data/sandbox/effects.ruleset +++ b/data/sandbox/effects.ruleset @@ -1642,39 +1642,42 @@ reqs = type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range", "present", "quiet" - "Gov", "Anarchy", "Player", TRUE, TRUE - "Building", "Pyramids", "Player", FALSE, FALSE - "Tech", "Railroad", "Player", FALSE, FALSE - "OutputType", "Gold", "Local", FALSE, TRUE - "OutputType", "Luxury", "Local", FALSE, TRUE - "OutputType", "Science", "Local", FALSE, TRUE + { "type", "name", "range", "present", "quiet" + "Gov", "Anarchy", "Player", TRUE, TRUE + "Building", "Pyramids", "Player", FALSE, FALSE + "Tech", "Railroad", "Player", FALSE, FALSE + "OutputType", "Gold", "Local", FALSE, TRUE + "OutputType", "Luxury", "Local", FALSE, TRUE + "OutputType", "Science", "Local", FALSE, TRUE + "CityStatus", "Celebrating", "City", FALSE, FALSE } [effect_gov_tile_penalty_tribal] type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range", "present", "quiet" - "Gov", "Tribal", "Player", TRUE, TRUE - "Building", "Pyramids", "Player", FALSE, FALSE - "Tech", "Railroad", "Player", FALSE, FALSE - "OutputType", "Gold", "Local", FALSE, TRUE - "OutputType", "Luxury", "Local", FALSE, TRUE - "OutputType", "Science", "Local", FALSE, TRUE + { "type", "name", "range", "present", "quiet" + "Gov", "Tribal", "Player", TRUE, TRUE + "Building", "Pyramids", "Player", FALSE, FALSE + "Tech", "Railroad", "Player", FALSE, FALSE + "OutputType", "Gold", "Local", FALSE, TRUE + "OutputType", "Luxury", "Local", FALSE, TRUE + "OutputType", "Science", "Local", FALSE, TRUE + "CityStatus", "Celebrating", "City", FALSE, FALSE } [effect_gov_tile_penalty_despotism] type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range", "present", "quiet" - "Gov", "Despotism", "Player", TRUE, TRUE - "Building", "Pyramids", "Player", FALSE, FALSE - "Tech", "Railroad", "Player", FALSE, FALSE - "OutputType", "Gold", "Local", FALSE, TRUE - "OutputType", "Luxury", "Local", FALSE, TRUE - "OutputType", "Science", "Local", FALSE, TRUE + { "type", "name", "range", "present", "quiet" + "Gov", "Despotism", "Player", TRUE, TRUE + "Building", "Pyramids", "Player", FALSE, FALSE + "Tech", "Railroad", "Player", FALSE, FALSE + "OutputType", "Gold", "Local", FALSE, TRUE + "OutputType", "Luxury", "Local", FALSE, TRUE + "OutputType", "Science", "Local", FALSE, TRUE + "CityStatus", "Celebrating", "City", FALSE, FALSE } [effect_gov_tile_bonus_republic] diff --git a/data/webperimental/effects.ruleset b/data/webperimental/effects.ruleset index 6d12a57ad0..cacac64bf9 100644 --- a/data/webperimental/effects.ruleset +++ b/data/webperimental/effects.ruleset @@ -693,16 +693,18 @@ reqs = type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Anarchy", "Player" + { "type", "name", "range", "present" + "Gov", "Anarchy", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_1] type = "Output_Penalty_Tile" value = 2 reqs = - { "type", "name", "range" - "Gov", "Despotism", "Player" + { "type", "name", "range", "present" + "Gov", "Despotism", "Player", TRUE + "CityStatus", "Celebrating", "City", FALSE } [effect_gov_tile_bonus_2] diff --git a/doc/README.effects b/doc/README.effects index 5a6cfd79cf..f003922eb9 100644 --- a/doc/README.effects +++ b/doc/README.effects @@ -558,8 +558,7 @@ Output_Inc_Tile_Celebrate Output_Penalty_Tile When a tile yields more output than amount, it gets a penalty of - -1 x output_granularity (from game.ruleset), unless the city working - it is celebrating. + -1 x output_granularity (from game.ruleset). Output_Per_Tile Increase tile output by amount percent. diff --git a/server/rscompat.c b/server/rscompat.c index c031fafc70..a3bbbeecfa 100644 --- a/server/rscompat.c +++ b/server/rscompat.c @@ -368,6 +368,11 @@ static bool effect_list_compat_cb(struct effect *peffect, void *data) break; } } requirement_vector_iterate_end; + } else if (peffect->type == EFT_OUTPUT_PENALTY_TILE) { + requirement_vector_append(&(peffect->reqs), + req_from_str("CityStatus", "City", + FALSE, FALSE, FALSE, + "Celebrating")); } } -- 2.43.0