From ce63763c4727c463b2ff963a1b889373c47548ec Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 10 Aug 2022 03:17:15 +0300 Subject: [PATCH 30/30] 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/savecompat.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/server/savecompat.c b/server/savecompat.c index 44ced7b6ff..d476c360dc 100644 --- a/server/savecompat.c +++ b/server/savecompat.c @@ -1221,6 +1221,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(); @@ -1264,7 +1266,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]; @@ -1310,6 +1311,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