From e800efedd37faaa9ce22cf5d04bbce828d59d6d8 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Thu, 12 Nov 2026 01:42:53 +0200
Subject: [PATCH 69/69] Revert "3.3 savecompat inserts city.original by wrong
 key"

but with extra changes and comments to make it clear
why the key is correct this way.
It's not about actual cities owned, but about FoW cities
known by the player.

See RM #2476

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 server/savegame/savecompat.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/server/savegame/savecompat.c b/server/savegame/savecompat.c
index 1859a91767..ac0f20a71c 100644
--- a/server/savegame/savecompat.c
+++ b/server/savegame/savecompat.c
@@ -2588,19 +2588,20 @@ static void compat_load_030300(struct loaddata *loading,
 
   player_slots_iterate(pslot) {
     int plrno = player_slot_index(pslot);
-    int ncities;
-    int cnro;
+    int ndcities;
+    int dcnro;
 
     if (secfile_section_lookup(loading->file, "player%d", plrno) == nullptr) {
       continue;
     }
 
-    ncities = secfile_lookup_int_default(loading->file, 0,
-                                         "player%d.dc_total", plrno);
+    /* FoW cities seen, not real ones owned. */
+    ndcities = secfile_lookup_int_default(loading->file, 0,
+                                          "player%d.dc_total", plrno);
 
-    for (cnro = 0; cnro < ncities; cnro++) {
-      secfile_insert_int(loading->file, -1, "player%d.c%d.original",
-                         plrno, cnro);
+    for (dcnro = 0; dcnro < ndcities; dcnro++) {
+      secfile_insert_int(loading->file, -1, "player%d.dc%d.original",
+                         plrno, dcnro);
     }
   } player_slots_iterate_end;
 }
-- 
2.53.0

