From db698d81c5147c277d039033df96ba18642f0638 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 5 Nov 2022 05:55:02 +0200 Subject: [PATCH 31/31] Rulesave: Add Trade settings section comment See osdn #45386 Signed-off-by: Marko Lindqvist --- data/ruledit/comments-3.2.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-3.2.txt b/data/ruledit/comments-3.2.txt index bf5b831aa7..47b0d9441b 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1068,6 +1068,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 0c3c5f4dda..8b13b583d6 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -44,6 +44,7 @@ static struct { char *ueffs; char *disasters; char *achievements; + char *trade_settings; char *goods; char *enablers; char *specialists; @@ -152,6 +153,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, @@ -438,6 +441,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 91d1bcc95e..b447ed6db6 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -56,6 +56,7 @@ void comment_nations(struct section_file *sfile); void comment_clauses(struct section_file *sfile); /* Other section comments */ +void comment_trade_settings(struct section_file *sfile); void comment_nations_ruledit(struct section_file *sfile); /* Entry comments */ diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index e4313b7485..eeb10ef9cc 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1663,6 +1663,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