From 477a7e134a88e9e83afb6a9ff1d3184d78ea71ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Lach?= Date: Sat, 15 Oct 2022 16:43:46 +0200 Subject: [PATCH] =?UTF-8?q?!OSDN:=20#TICKET:=2045429=20-=20S=C5=82awomir?= =?UTF-8?q?=20Lach=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Send city counters (at turn end) for player, who own this city. Also add support for this packet to client-side. Client routines will only update information. diff --git a/server/citytools.c b/server/citytools.c index fff72c22d8..43f5b5690e 100644 --- a/server/citytools.c +++ b/server/citytools.c @@ -2234,6 +2234,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); lsend_packet_city_nationalities(pplayer->connections, &nat_packet, FALSE); lsend_packet_city_rally_point(pplayer->connections, &rally_packet, FALSE); @@ -2336,6 +2337,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 57df7a36a1..6cb18b1cb1 100644 --- a/server/cityturn.c +++ b/server/cityturn.c @@ -3345,6 +3345,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."), @@ -3356,6 +3364,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 dc0e0781ed..9544b74c85 100644 --- a/server/srv_main.c +++ b/server/srv_main.c @@ -1545,6 +1545,11 @@ static void end_turn(void) city_counter_refresh(pcity, pcount->index); } + + if (pcity->counter_values[pcount->index] != old_val) { + + city_counter_refresh(pcity, pcount->index); + } } city_counters_iterate_end; } city_list_iterate_end; } players_iterate_end; -- 2.38.1