From 957d711982d1d5012ec8c5b6e89e2bc75d7041c5 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 10 Aug 2022 03:15:12 +0300 Subject: [PATCH 50/50] Savecompat: Convert E_UNIT_WIN to E_UNIT_WIN_DEF Event has been renamed in freeciv-3.0. See osdn #44809 Signed-off-by: Marko Lindqvist --- server/savegame/savecompat.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/server/savegame/savecompat.c b/server/savegame/savecompat.c index 6cd1e1af23..4587e23e11 100644 --- a/server/savegame/savecompat.c +++ b/server/savegame/savecompat.c @@ -1310,6 +1310,8 @@ static void compat_load_030000(struct loaddata *loading, int num_settings; bool started; int old_turn; + int event_count; + int i; /* Check status and return if not OK (sg_success FALSE). */ sg_check_ret(); @@ -1353,7 +1355,6 @@ static void compat_load_030000(struct loaddata *loading, int num = secfile_lookup_int_default(loading->file, 0, "player%d.nunits", plrno); - int i; for (i = 0; i < num; i++) { char buf[64]; @@ -1399,6 +1400,19 @@ static void compat_load_030000(struct loaddata *loading, } secfile_replace_int(loading->file, num_settings, "settings.set_count"); + + event_count = secfile_lookup_int_default(loading->file, 0, "event_cache.count"); + + for (i = 0; i < event_count; i++) { + const char *etype; + + etype = secfile_lookup_str(loading->file, "event_cache.events%d.event", i); + + if (etype != NULL && !fc_strcasecmp("E_UNIT_WIN", etype)) { + secfile_replace_str(loading->file, "E_UNIT_WIN_DEF", + "event_cache.events%d.event", i); + } + } } /************************************************************************//** -- 2.35.1