From e1ff44b3c0904bfdb7fa95a5d0b5d709449941ac Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 1 Feb 2022 07:00:28 +0200 Subject: [PATCH 44/44] Set 'max_growth' field of cma preset to default value when loading options We don't have gui for adjusting 'max_growth' field, nor is it stored in the client options file. At this time it should be always the default in presets. As we were not initializing it when loading the options, it was getting non-default value. This in turn lead the preset loaded from the client options not to match what the cities in the savegame were set to. Thus the client showed the Governor of these cities to be "custom" rather than the named preset. Reported by chippo See osdn #42253 Signed-off-by: Marko Lindqvist --- client/options.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/options.c b/client/options.c index 78ee427f3f..af316f1414 100644 --- a/client/options.c +++ b/client/options.c @@ -5054,6 +5054,10 @@ static void load_cma_preset(struct section_file *file, int i) secfile_lookup_str_default(file, "preset", "cma.preset%d.name", i); + /* Init correct default values even for the fields that are not + * loaded below. */ + cm_init_parameter(¶meter); + output_type_iterate(o) { parameter.minimal_surplus[o] = secfile_lookup_int_default(file, 0, "cma.preset%d.minsurp%d", i, o); -- 2.34.1