From 5c9adbd7169feee50632351f8112e7c79c7c15e3 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 29 Aug 2022 02:15:21 +0300 Subject: [PATCH 59/59] Fix savegame2.c "unused entry" warnings about got_tech_multi See osdn #45380 Signed-off-by: Marko Lindqvist --- server/savegame/savecompat.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/server/savegame/savecompat.c b/server/savegame/savecompat.c index 4e5806ecbe..520a4597af 100644 --- a/server/savegame/savecompat.c +++ b/server/savegame/savecompat.c @@ -2102,17 +2102,19 @@ static void compat_load_030200(struct loaddata *loading, secfile_replace_int(loading->file, set_count, "settings.set_count"); } - /* Older savegames had a bug that got_tech_multi was not saved. - * Insert the entry to such savegames */ - - /* May be unsaved (e.g. scenario case). */ - count = secfile_lookup_int_default(loading->file, 0, "research.count"); - for (i = 0; i < count; i++) { - if (secfile_entry_lookup(loading->file, - "research.r%d.got_tech_multi", i) == NULL) { - /* Default to FALSE */ - secfile_insert_bool(loading->file, FALSE, - "research.r%d.got_tech_multi", i); + if (format_class == SAVEGAME_3) { + /* Older savegames had a bug that got_tech_multi was not saved. + * Insert the entry to such savegames */ + + /* May be unsaved (e.g. scenario case). */ + count = secfile_lookup_int_default(loading->file, 0, "research.count"); + for (i = 0; i < count; i++) { + if (secfile_entry_lookup(loading->file, + "research.r%d.got_tech_multi", i) == NULL) { + /* Default to FALSE */ + secfile_insert_bool(loading->file, FALSE, + "research.r%d.got_tech_multi", i); + } } } } -- 2.35.1