From d37a0d035bbe80bf119d39915288db73cc32720c Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 3 Nov 2021 17:38:24 +0200 Subject: [PATCH 7/7] Rulesave: Save goods_selection value See osdn #43158 Signed-off-by: Marko Lindqvist --- server/ruleset.c | 4 +++- server/ruleset.h | 2 ++ tools/ruleutil/rulesave.c | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/server/ruleset.c b/server/ruleset.c index 01bc51cf8b..d714236508 100644 --- a/server/ruleset.c +++ b/server/ruleset.c @@ -6632,7 +6632,9 @@ static bool load_ruleset_game(struct section_file *file, bool act, } if (ok) { - const char *str = secfile_lookup_str_default(file, "Leaving", "trade.goods_selection"); + const char *str = secfile_lookup_str_default(file, + goods_selection_method_name(RS_DEFAULT_GOODS_SELECTION), + "trade.goods_selection"); game.info.goods_selection = goods_selection_method_by_name(str, fc_strcasecmp); diff --git a/server/ruleset.h b/server/ruleset.h index f42182b7a0..06a389c9b4 100644 --- a/server/ruleset.h +++ b/server/ruleset.h @@ -88,6 +88,8 @@ char *get_script_buffer(void); #define RS_DEFAULT_CULTURE_VIC_LEAD 300 #define RS_DEFAULT_CULTURE_MIGRATION_PML 50 +#define RS_DEFAULT_GOODS_SELECTION GSM_LEAVING + #define RS_DEFAULT_EXTRA_APPEARANCE 15 #define RS_DEFAULT_EXTRA_DISAPPEARANCE 15 diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 728ae658d1..3f8de307ea 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1267,6 +1267,11 @@ static bool save_game_ruleset(const char *filename, const char *name) } } + if (game.info.goods_selection != RS_DEFAULT_GOODS_SELECTION) { + secfile_insert_str(sfile, goods_selection_method_name(game.info.goods_selection), + "trade.goods_selection"); + } + /* Goods */ comment_goods(sfile); -- 2.30.2