From 2dc7bceab399e759c805a89072eb6fa20c7eda8c Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 5 Nov 2022 05:55:02 +0200 Subject: [PATCH 29/29] Rulesave: Add Trade settings section comment See osdn #45386 Signed-off-by: Marko Lindqvist --- data/ruledit/comments.txt | 24 ++++++++++++++++++++++++ tools/ruleutil/comments.c | 11 +++++++++++ tools/ruleutil/comments.h | 1 + tools/ruleutil/rulesave.c | 2 ++ 4 files changed, 38 insertions(+) diff --git a/data/ruledit/comments.txt b/data/ruledit/comments.txt index 91ba2085b7..d201111ca0 100644 --- a/data/ruledit/comments.txt +++ b/data/ruledit/comments.txt @@ -1030,6 +1030,30 @@ achievements = "\ ; */ <-- avoid gettext warnings\n\ " +trade_settings = "\ +\n\ +;\n\ +; Trade settings\n\ +;\n\ +; IN = international, IC = intercontinental.\n\ +; For each of the trade route types:\n\ +; \"pct\" - Trade income %. If this is 0, trade route cannot be\n\ +; established at all\n\ +; \"cancelling\" - What to do to previously established traderoutes when they\n\ +; turn illegal\n\ +; \"Active\" - Keep them active (although they will only\n\ +; provide nonzero income if illegal due to\n\ +; trademindist rather than pct==0)\n\ +; \"Inactive\" - Keep them inactive\n\ +; \"Cancel\" - Cancel them altogether\n\ +; \"bonus\" - One-time bonuses granted when traderoute established\n\ +; \"None\" - No one-time bonus\n\ +; \"Gold\" - Bonus to gold\n\ +; \"Science\" - Bonus to research\n\ +; \"Both\" - Bonus to gold and research\n\ +;\ +" + goods = "\ \n\ ; /* <-- avoid gettext warnings\n\ diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index 3e9327e3e0..a62051b596 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -42,6 +42,7 @@ static struct { char *effects; char *disasters; char *achievements; + char *trade_settings; char *goods; char *enablers; char *specialists; @@ -110,6 +111,8 @@ bool comments_load(void) comment_file, "typedoc.disasters"); comment_load(comments_storage.achievements, comment_file, "typedoc.achievements"); + comment_load(comments_storage.trade_settings, + comment_file, "typedoc.trade_settings"); comment_load(comments_storage.goods, comment_file, "typedoc.goods"); comment_load(comments_storage.enablers, comment_file, "typedoc.enablers"); comment_load(comments_storage.specialists, @@ -303,6 +306,14 @@ void comment_achievements(struct section_file *sfile) comment_write(sfile, comments_storage.achievements, "Achievements"); } +/************************************************************************** + Write trade settings header. +**************************************************************************/ +void comment_trade_settings(struct section_file *sfile) +{ + comment_write(sfile, comments_storage.trade_settings, "Trade settings"); +} + /************************************************************************** Write goods header. **************************************************************************/ diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index cd8b8ab057..19156d8440 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -50,6 +50,7 @@ void comment_nationgroups(struct section_file *sfile); void comment_nations(struct section_file *sfile); /* Other section comments */ +void comment_trade_settings(struct section_file *sfile); void comment_nations_ruledit(struct section_file *sfile); #ifdef __cplusplus diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 5077008042..43609f3f06 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1248,6 +1248,8 @@ static bool save_game_ruleset(const char *filename, const char *name) } achievements_iterate_end; + comment_trade_settings(sfile); + set_count = 0; for (trt = 0; trt < TRT_LAST; trt++) { struct trade_route_settings *set = trade_route_settings_by_type(trt); -- 2.35.1