From 7874e2c4cd4bc70874fbc9b600d2c65be2f892fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Lach?= <slawek@lach.art.pl>
Date: Sun, 10 Dec 2023 13:03:46 +0100
Subject: [PATCH] =?UTF-8?q?!OSDN:45889:S=C5=82awomir=20Lach<slawek@lach.ar?=
 =?UTF-8?q?t.pl>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

1.Resend counters' values once reconnect
2.Send counters' values on game load

diff --git a/server/srv_main.c b/server/srv_main.c
index 94a15e7280..ebee8bfe3b 100644
--- a/server/srv_main.c
+++ b/server/srv_main.c
@@ -711,6 +711,25 @@ void send_all_info(struct conn_list *dest)
   cities_iterate(pcity) {
     package_and_send_worker_tasks(pcity);
   } cities_iterate_end;
+
+  players_iterate(pplayer) {
+    city_list_iterate(pplayer->cities,pcity) {
+      int i, counter_count;
+      struct packet_city_update_counters packet;
+
+      packet.city = pcity->id;
+
+      counter_count = counters_get_city_counters_count();
+
+      packet.count = counter_count;
+      for (i = 0; i < counter_count; i++) {
+         packet.counters[i] = pcity->counter_values[i];
+      }
+
+      lsend_packet_city_update_counters(game.glob_observers,&packet);
+      lsend_packet_city_update_counters(pplayer->connections,&packet);
+    } city_list_iterate_end;
+} players_iterate_end;
 }
 
 /**********************************************************************//**
-- 
2.43.0