From 700be2879d06309ad8e70eed6f638f9c91a95fa7 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 12 Aug 2024 16:29:22 +0300 Subject: [PATCH 12/12] Add ruleset option ruledit.std_tileset_compat See osdn #45540 Signed-off-by: Marko Lindqvist --- common/game.h | 1 + data/alien/game.ruleset | 6 ++++++ data/civ1/game.ruleset | 6 ++++++ data/civ2/game.ruleset | 6 ++++++ data/civ2civ3/game.ruleset | 6 ++++++ data/classic/game.ruleset | 6 ++++++ data/goldkeep/game.ruleset | 6 ++++++ data/granularity/game.ruleset | 6 ++++++ data/multiplayer/game.ruleset | 6 ++++++ data/ruledit/comments-3.3.txt | 7 +++++++ data/sandbox/game.ruleset | 6 ++++++ data/stub/game.ruleset | 6 ++++++ data/webperimental/game.ruleset | 6 ++++++ server/ruleset/ruleload.c | 2 ++ tools/ruleutil/comments.c | 14 ++++++++++++++ tools/ruleutil/comments.h | 1 + tools/ruleutil/rulesave.c | 6 ++++++ 17 files changed, 97 insertions(+) diff --git a/common/game.h b/common/game.h index 25e54edb92..fe9ffeab9f 100644 --- a/common/game.h +++ b/common/game.h @@ -294,6 +294,7 @@ struct civ_game { char **nc_astyles; size_t as_count; int named_teams; + bool std_tileset_compat; } ruledit; } server; }; diff --git a/data/alien/game.ruleset b/data/alien/game.ruleset index 3b136890f8..2a8871bd2e 100644 --- a/data/alien/game.ruleset +++ b/data/alien/game.ruleset @@ -23,6 +23,12 @@ format_version = 40 ; Which file to read description in from. description_file = "alien/README.alien" +; Should ruleset upgrade do changes matching changes to the standard tilesets +; of the freeciv distribution. Custom tilesets might do not implement similar +; changes, so to remain compatible with them shouldn't do these +; ruleset changes either (to have this as FALSE) +std_tileset_compat = FALSE + [about] ; Ruleset name name = _("Alien World") diff --git a/data/civ1/game.ruleset b/data/civ1/game.ruleset index f3cf379f5f..788d9f3af8 100644 --- a/data/civ1/game.ruleset +++ b/data/civ1/game.ruleset @@ -21,6 +21,12 @@ format_version = 40 ; Which file to read description in from. ;description_file = "" +; Should ruleset upgrade do changes matching changes to the standard tilesets +; of the freeciv distribution. Custom tilesets might do not implement similar +; changes, so to remain compatible with them shouldn't do these +; ruleset changes either (to have this as FALSE) +std_tileset_compat = TRUE + [about] ; Ruleset name name = _("Civ1 ruleset") diff --git a/data/civ2/game.ruleset b/data/civ2/game.ruleset index e187acd12d..dfbf9dd85b 100644 --- a/data/civ2/game.ruleset +++ b/data/civ2/game.ruleset @@ -21,6 +21,12 @@ format_version = 40 ; Which file to read description in from. ;description_file = "" +; Should ruleset upgrade do changes matching changes to the standard tilesets +; of the freeciv distribution. Custom tilesets might do not implement similar +; changes, so to remain compatible with them shouldn't do these +; ruleset changes either (to have this as FALSE) +std_tileset_compat = TRUE + [about] ; Ruleset name name = _("Civ2 ruleset") diff --git a/data/civ2civ3/game.ruleset b/data/civ2civ3/game.ruleset index e171274e69..4f4cc639b7 100644 --- a/data/civ2civ3/game.ruleset +++ b/data/civ2civ3/game.ruleset @@ -21,6 +21,12 @@ format_version = 40 ; Which file to read description in from. description_file = "civ2civ3/README.civ2civ3" +; Should ruleset upgrade do changes matching changes to the standard tilesets +; of the freeciv distribution. Custom tilesets might do not implement similar +; changes, so to remain compatible with them shouldn't do these +; ruleset changes either (to have this as FALSE) +std_tileset_compat = TRUE + [about] ; Ruleset name name = _("Civ2Civ3 ruleset") diff --git a/data/classic/game.ruleset b/data/classic/game.ruleset index 9977629704..9468e22d20 100644 --- a/data/classic/game.ruleset +++ b/data/classic/game.ruleset @@ -21,6 +21,12 @@ format_version = 40 ; Which file to read description in from. description_file = "classic/README.classic" +; Should ruleset upgrade do changes matching changes to the standard tilesets +; of the freeciv distribution. Custom tilesets might do not implement similar +; changes, so to remain compatible with them shouldn't do these +; ruleset changes either (to have this as FALSE) +std_tileset_compat = TRUE + [about] ; Ruleset name name = _("Classic ruleset") diff --git a/data/goldkeep/game.ruleset b/data/goldkeep/game.ruleset index d4df46af74..99b6c0da85 100644 --- a/data/goldkeep/game.ruleset +++ b/data/goldkeep/game.ruleset @@ -24,6 +24,12 @@ format_version = 40 ; Which file to read description in from. description_file = "goldkeep/README.goldkeep" +; Should ruleset upgrade do changes matching changes to the standard tilesets +; of the freeciv distribution. Custom tilesets might do not implement similar +; changes, so to remain compatible with them shouldn't do these +; ruleset changes either (to have this as FALSE) +std_tileset_compat = TRUE + [about] ; Ruleset name name = _("Goldkeep ruleset") diff --git a/data/granularity/game.ruleset b/data/granularity/game.ruleset index f5485da68e..8cb235dfe4 100644 --- a/data/granularity/game.ruleset +++ b/data/granularity/game.ruleset @@ -21,6 +21,12 @@ format_version = 40 ; Which file to read description in from. description_file = "granularity/README.granularity" +; Should ruleset upgrade do changes matching changes to the standard tilesets +; of the freeciv distribution. Custom tilesets might do not implement similar +; changes, so to remain compatible with them shouldn't do these +; ruleset changes either (to have this as FALSE) +std_tileset_compat = FALSE + [about] ; Ruleset name name = _("Granularity") diff --git a/data/multiplayer/game.ruleset b/data/multiplayer/game.ruleset index 1e84e0f6ad..804a7a88fd 100644 --- a/data/multiplayer/game.ruleset +++ b/data/multiplayer/game.ruleset @@ -21,6 +21,12 @@ format_version = 40 ; Which file to read description in from. description_file = "multiplayer/README.multiplayer" +; Should ruleset upgrade do changes matching changes to the standard tilesets +; of the freeciv distribution. Custom tilesets might do not implement similar +; changes, so to remain compatible with them shouldn't do these +; ruleset changes either (to have this as FALSE) +std_tileset_compat = TRUE + [about] ; Ruleset name name = _("Multiplayer ruleset") diff --git a/data/ruledit/comments-3.3.txt b/data/ruledit/comments-3.3.txt index 8d0f91dd83..7ad25482bc 100644 --- a/data/ruledit/comments-3.3.txt +++ b/data/ruledit/comments-3.3.txt @@ -1630,3 +1630,10 @@ calendar_fragments = "\n\ ; needed to control fragment accumulation.\n\ ; Value 0 here disables year advancement by fragment accumulation.\ " + +std_tileset_compat = "\n\ +; Should ruleset upgrade do changes matching changes to the standard tilesets\n\ +; of the freeciv distribution. Custom tilesets might do not implement similar\n\ +; changes, so to remain compatible with them shouldn\'t do these\n\ +; ruleset changes either (to have this as FALSE)\ +" diff --git a/data/sandbox/game.ruleset b/data/sandbox/game.ruleset index e4e9cba19f..c80b01bd81 100644 --- a/data/sandbox/game.ruleset +++ b/data/sandbox/game.ruleset @@ -21,6 +21,12 @@ format_version = 40 ; Which file to read description in from. description_file = "sandbox/README.sandbox" +; Should ruleset upgrade do changes matching changes to the standard tilesets +; of the freeciv distribution. Custom tilesets might do not implement similar +; changes, so to remain compatible with them shouldn't do these +; ruleset changes either (to have this as FALSE) +std_tileset_compat = TRUE + [about] ; Ruleset name name = _("Sandbox ruleset") diff --git a/data/stub/game.ruleset b/data/stub/game.ruleset index f784cf6bdd..7d6bbeff52 100644 --- a/data/stub/game.ruleset +++ b/data/stub/game.ruleset @@ -13,6 +13,12 @@ format_version = 40 ; Which file to read description in from. ;description_file = "" +; Should ruleset upgrade do changes matching changes to the standard tilesets +; of the freeciv distribution. Custom tilesets might do not implement similar +; changes, so to remain compatible with them shouldn't do these +; ruleset changes either (to have this as FALSE) +std_tileset_compat = TRUE + [about] ; Ruleset name name = _("Stub") diff --git a/data/webperimental/game.ruleset b/data/webperimental/game.ruleset index 5541a1e2e4..1e8a4bfad4 100644 --- a/data/webperimental/game.ruleset +++ b/data/webperimental/game.ruleset @@ -21,6 +21,12 @@ format_version = 40 ; Which file to read description in from. description_file = "webperimental/README.webperimental" +; Should ruleset upgrade do changes matching changes to the standard tilesets +; of the freeciv distribution. Custom tilesets might do not implement similar +; changes, so to remain compatible with them shouldn't do these +; ruleset changes either (to have this as FALSE) +std_tileset_compat = TRUE + [about] ; Ruleset name name = _("Webperimental") diff --git a/server/ruleset/ruleload.c b/server/ruleset/ruleload.c index c0e8710b26..9fe49b97dd 100644 --- a/server/ruleset/ruleload.c +++ b/server/ruleset/ruleload.c @@ -6573,6 +6573,8 @@ static bool load_ruleset_game(struct section_file *file, bool act, if (name != NULL) { game.server.ruledit.description_file = fc_strdup(name); } + game.server.ruledit.std_tileset_compat + = secfile_lookup_bool_default(file, FALSE, "ruledit.std_tileset_compat"); /* Section: tileset */ pref_text = secfile_lookup_str_default(file, "", "tileset.preferred"); diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index 1f032614ac..00c65d5b60 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -98,6 +98,8 @@ static struct { char *culture_migration_pml; char *world_peace_turns; char *calendar_fragments; + + char *std_tileset_compat; } comments_storage; /**********************************************************************//** @@ -259,6 +261,8 @@ bool comments_load(void) "entrydoc.world_peace_turns"); comment_load(comments_storage.calendar_fragments, comment_file, "entrydoc.calendar_fragments"); + comment_load(comments_storage.std_tileset_compat, comment_file, + "entrydoc.std_tileset_compat"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -903,3 +907,13 @@ void comment_calendar_fragments(struct section_file *sfile) comment_entry_write(sfile, comments_storage.calendar_fragments, "calendar"); } + + +/**********************************************************************//** + Write std_tileset_compat settings header. +**************************************************************************/ +void comment_std_tileset_compat(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.std_tileset_compat, + "std_tileset_compat"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index 05ae8ff2ad..d83e2abfd4 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -102,6 +102,7 @@ void comment_culture_history_interest(struct section_file *sfile); void comment_culture_migration_pml(struct section_file *sfile); void comment_world_peace_turns(struct section_file *sfile); void comment_calendar_fragments(struct section_file *sfile); +void comment_std_tileset_compat(struct section_file *sfile); void comment_counters(struct section_file *sfile); #ifdef __cplusplus diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index d51d1f6cc6..126acbecc8 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1269,6 +1269,12 @@ static bool save_game_ruleset(const char *filename, const char *name) "ruledit.description_file"); } + if (game.server.ruledit.std_tileset_compat) { + comment_std_tileset_compat(sfile); + secfile_insert_bool(sfile, game.server.ruledit.std_tileset_compat, + "ruledit.std_tileset_compat"); + } + if (game.control.preferred_tileset[0] != '\0') { secfile_insert_str(sfile, game.control.preferred_tileset, "tileset.preferred"); -- 2.43.0