From 46a97a1da9b7eb9b7de836db19142f62ebcb00e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Lach?= Date: Sat, 29 Oct 2022 18:00:58 +0200 Subject: [PATCH] =?UTF-8?q?!OSDN=20Ticket=20#45889:=20S=C5=82awomir=20Lach?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Server will send new value for celebrating diff --git a/data/sandbox/effects.ruleset b/data/sandbox/effects.ruleset index 3f727c29e7..9b265ee027 100644 --- a/data/sandbox/effects.ruleset +++ b/data/sandbox/effects.ruleset @@ -5415,7 +5415,7 @@ type = "Enemy_Citizen_Unhappy_Pct" value = 30 reqs = { "type", "name", "range", "present", "quiet" - "Counter", "Owned", "City", FALSE, TRUE + "Counter", "Reduce Enemy Happiness", "City", FALSE, FALSE } @@ -5424,7 +5424,7 @@ type = "Enemy_Citizen_Unhappy_Pct" value = 20 reqs = { "type", "name", "range", "present", "quiet" - "Counter", "Owned2", "City", FALSE, TRUE + "Counter", "Further Reduce Enemy Happiness", "City", FALSE, FALSE } @@ -5433,6 +5433,6 @@ type = "Output_Add_Tile" value = -1 reqs = { "type", "name", "range", "present", "quiet" - "Counter", "Owned3", "City", FALSE, TRUE + "Counter", "Reduce production after conquering city", "City", FALSE, FALSE } diff --git a/data/sandbox/game.ruleset b/data/sandbox/game.ruleset index 558d15d133..72ea6335b9 100644 --- a/data/sandbox/game.ruleset +++ b/data/sandbox/game.ruleset @@ -3532,6 +3532,44 @@ type = "Vision" [clause_embassy] type = "Embassy" +[clause_sharedtiles] +type = "SharedTiles" + +;Counter types +; +;name = translatable name as seen by user +;rule_name = (optional) internal name for savegames, rulesets +; etc; if not present, "name" is used for this +; purpose too. Since the name used in savegames must +; not change, if you want to rename an item after a +; ruleset has been released, you should set +; "rule_name" to the original value of "name". +;checkpoint = Trigger value of the counter. When counter's +; value is at least this much, the "Counter" requirement +; is fulfilled. +;def = Initial value of the counter. +;type = Behavior of the counter: +; "Owned" - Increased each turn, zeroed when city changes owner + +[counter_owned1] +name = _("Reduce Enemy Happiness") +def = 0 +checkpoint = 5 +type = "OWNED" + +[counter_owned2] +name = _("Further Reduce Enemy Happiness") +def = 0 +checkpoint = 7 +type = "OWNED" + +; Default value are 6, so citizens do not strike right after build the city +; city may to be conquered to made citizens striking +[counter_owned3_strike] +name = _("Reduce production after conquering city") +def = 6 +checkpoint = 5 +type = "OWNED" [playercolors] background.r = 86 @@ -3613,5 +3651,6 @@ set = "techlossrestore", 50, FALSE "multiresearch", "ENABLED", FALSE "tradeworldrelpct", 100, FALSE - "alltemperate", "DISABLED", TRUE + "northlatitude", 1000, TRUE + "southlatitude", -1000, TRUE } diff --git a/server/citytools.c b/server/citytools.c index 8c3830f18e..7d253036ab 100644 --- a/server/citytools.c +++ b/server/citytools.c @@ -2227,6 +2227,7 @@ void broadcast_city_info(struct city *pcity) if (!send_city_suppressed || pplayer != powner) { if (can_player_see_city_internals(pplayer, pcity)) { update_dumb_city(pplayer, pcity); + lsend_packet_city_info(pplayer->connections, &packet, FALSE); web_lsend_packet(city_info_addition, pplayer->connections, webp_ptr, FALSE); @@ -2325,6 +2326,11 @@ void send_city_info(struct player *dest, struct city *pcity) send_city_info_at_tile(dest, dest->connections, pcity, pcity->tile); } + /* Sending counters */ + city_counters_iterate(pcount) { + city_counter_refresh(pcity, pcount->index); + } city_counters_iterate_end; + if (game.info.team_pooled_research && player_list_size(team_members(powner->team)) > 1) { /* We want to send the new total bulbs production of the team. */ diff --git a/server/cityturn.c b/server/cityturn.c index 003536843b..bce494e514 100644 --- a/server/cityturn.c +++ b/server/cityturn.c @@ -3316,6 +3316,14 @@ static void update_city_activity(struct city *pcity) if (city_celebrating(pcity) || is_celebrating) { pcity->rapture++; + + /* Update city's celebrating counters */ + city_counters_iterate(pcount) { + if (pcount->type == CB_CITY_CELEBRATION_TURNS) { + pcity->counter_values[pcount->index]++; + } + } city_counters_iterate_end; + if (pcity->rapture == 1) { notify_player(pplayer, city_tile(pcity), E_CITY_LOVE, ftc_server, _("Celebrations in your honor in %s."), @@ -3327,6 +3335,13 @@ static void update_city_activity(struct city *pcity) _("Celebrations canceled in %s."), city_link(pcity)); } + + /* Update city's celebrating counters */ + city_counters_iterate(pcount) { + if (pcount->type == CB_CITY_CELEBRATION_TURNS) { + pcity->counter_values[pcount->index] = 0; + } + } city_counters_iterate_end; pcity->rapture = 0; } pcity->was_happy = is_happy; diff --git a/server/srv_main.c b/server/srv_main.c index b986f1f1dd..64c2576d7a 100644 --- a/server/srv_main.c +++ b/server/srv_main.c @@ -1542,15 +1542,6 @@ static void end_turn(void) pcity->counter_values[pcount->index]++; } - if (pcount->type == CB_CITY_CELEBRATION_TURNS) { - if (pcity->was_happy) { - pcity->counter_values[pcount->index]++; - } - else { - pcity->counter_values[pcount->index] = 0; - } - } - if (pcity->counter_values[pcount->index] != old_val) { city_counter_refresh(pcity, pcount->index); -- 2.38.1