From b0ad89c713c61f054f0374ca0c9482143c7b2c63 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 4 Nov 2021 18:46:50 +0200 Subject: [PATCH 13/13] Save information if player has gained tech under multiresearch to savegame Lack of that information caused player to lose bulbs when switching research Reported by Lexxie See osdn #43161 Signed-off-by: Marko Lindqvist --- server/savegame/savegame3.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/savegame/savegame3.c b/server/savegame/savegame3.c index bf6ea140d0..b315575563 100644 --- a/server/savegame/savegame3.c +++ b/server/savegame/savegame3.c @@ -7082,6 +7082,13 @@ static void sg_load_researches(struct loaddata *loading) "research.r%d.got_tech", i), "%s", secfile_error()); + /* Older savegames (3.0 betas) had a bug that got_tech_multi was not saved. + * Have to live with such savegames, so can't make it an error if value + * is not found from the savegame. */ + presearch->got_tech_multi = secfile_lookup_bool_default(loading->file, FALSE, + "research.r%d.got_tech_multi", + i); + str = secfile_lookup_str(loading->file, "research.r%d.done", i); sg_failure_ret(str != NULL, "%s", secfile_error()); sg_failure_ret(strlen(str) == loading->technology.size, @@ -7174,6 +7181,8 @@ static void sg_save_researches(struct savedata *saving) i, presearch->researching); secfile_insert_bool(saving->file, presearch->got_tech, "research.r%d.got_tech", i); + secfile_insert_bool(saving->file, presearch->got_tech_multi, + "research.r%d.got_tech_multi", i); /* Save technology lists as bytevector. Note that technology order is * saved in savefile.technology.order */ advance_index_iterate(A_NONE, tech_id) { -- 2.30.2