From 12c1c3b24b4d1cd12be02bda3642020ede970420 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 9 May 2024 17:42:10 +0300 Subject: [PATCH 72/72] Savegame: Load map random seed Though it's not really used, we want to remember it for resaving purposes. Reported by alain_bkr See osdn #47981 Signed-off-by: Marko Lindqvist --- server/savegame/savegame3.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/savegame/savegame3.c b/server/savegame/savegame3.c index 2a633860f9..0a4726d538 100644 --- a/server/savegame/savegame3.c +++ b/server/savegame/savegame3.c @@ -2832,9 +2832,10 @@ static void sg_load_map(struct loaddata *loading) wld.map.server.have_resources = game.scenario.have_resources; - /* Savegame may store random_seed for documentation purposes only, - * we don't need it. Just silence "unused entry" warning. */ - (void) secfile_entry_lookup(loading->file, "map.random_seed"); + /* Savegame may have stored random_seed for documentation purposes only, + * but we want to keep it for resaving. */ + wld.map.server.seed + = secfile_lookup_int_default(loading->file, 0, "map.random_seed"); if (S_S_INITIAL == loading->server_state && MAPGEN_SCENARIO == wld.map.server.generator) { @@ -2895,7 +2896,7 @@ static void sg_save_map(struct savedata *saving) * Do not save it if it's 0 (not known); * this confuses people reading this 'document' less than * saving 0. */ - if (wld.map.server.seed) { + if (wld.map.server.seed != 0) { secfile_insert_int(saving->file, wld.map.server.seed, "map.random_seed"); } -- 2.43.0