From 5a5d5bb3b979626a25f44abce5e87686c7ea367d Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 12 Oct 2021 17:45:29 +0300 Subject: [PATCH 32/32] rscompat: Set wonder upkeep to zero when loading 3.0 ruleset See osdn #43006 Signed-off-by: Marko Lindqvist --- server/rscompat.c | 21 +++++++++++++++++++++ server/rscompat.h | 1 + server/ruleset.c | 2 ++ 3 files changed, 24 insertions(+) diff --git a/server/rscompat.c b/server/rscompat.c index 78f3e4a1fe..aafdd5275b 100644 --- a/server/rscompat.c +++ b/server/rscompat.c @@ -709,6 +709,27 @@ bool rscompat_old_effect_3_1(const char *type, struct section_file *file, return FALSE; } +/**********************************************************************//** + Do compatibility things after regular ruleset loading, but before + sanity checking. +**************************************************************************/ +void rscompat_adjust_pre_sanity(struct rscompat_info *info) +{ + if (!info->compat_mode) { + /* There isn't anything here that should be done outside of compat + * mode. */ + return; + } + + if (info->ver_buildings < RSFORMAT_3_1) { + improvement_iterate(pimprove) { + if (pimprove->upkeep != 0 && is_wonder(pimprove)) { + pimprove->upkeep = 0; + } + } improvement_iterate_end; + } +} + /**********************************************************************//** Do compatibility things after regular ruleset loading. **************************************************************************/ diff --git a/server/rscompat.h b/server/rscompat.h index 4f3029b976..9013736ffd 100644 --- a/server/rscompat.h +++ b/server/rscompat.h @@ -48,6 +48,7 @@ int rscompat_check_capabilities(struct section_file *file, const char *filename, bool rscompat_names(struct rscompat_info *info); +void rscompat_adjust_pre_sanity(struct rscompat_info *info); void rscompat_postprocess(struct rscompat_info *info); /* General upgrade functions that should be kept to avoid regressions in diff --git a/server/ruleset.c b/server/ruleset.c index 42329085d7..8f6a0d1bbd 100644 --- a/server/ruleset.c +++ b/server/ruleset.c @@ -9251,6 +9251,8 @@ static bool load_rulesetdir(const char *rsdir, bool compat_mode, } if (ok) { + rscompat_adjust_pre_sanity(&compat_info); + /* Init nations we just loaded. */ update_nations_with_startpos(); -- 2.33.0