Author: cazfi
Date: Fri Jul  1 09:05:08 2016
New Revision: 33139

URL: http://svn.gna.org/viewcvs/freeciv?rev=33139&view=rev
Log:
Save documentation comment about nation.ruleset objects' format to ruleset

See patch #7351

Modified:
    trunk/data/alien/nations.ruleset
    trunk/data/civ1/nations.ruleset
    trunk/data/civ2/nations.ruleset
    trunk/data/default/nationlist.ruleset
    trunk/data/ruledit/comments.txt
    trunk/tools/ruleutil/comments.c
    trunk/tools/ruleutil/comments.h
    trunk/tools/ruleutil/rulesave.c

Modified: trunk/data/alien/nations.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/nations.ruleset?rev=33139&r1=33138&r2=33139&view=diff
==============================================================================
--- trunk/data/alien/nations.ruleset    (original)
+++ trunk/data/alien/nations.ruleset    Fri Jul  1 09:05:08 2016
@@ -66,7 +66,7 @@
 ; The first set defined is the one that is used by default. It is mandatory
 ; to have at least one, but if there is only one, it will be kept out of
 ; the user`s way.
-; name                 = Translatable name of the set presented in the UI.
+; name          = Translatable name of the set presented in the UI.
 ; rule_name     = Unique persistent name; this is also visible to users as
 ;                 the value of the "nationset" server option, and presented
 ;                 in "/list nationsets". It should thus be short, in lower
@@ -87,11 +87,11 @@
 ; These are more cosmetic than sets; they affect the "pick nation" dialog,
 ; random nation selection, and possibly ruleset behaviour.
 ; It`s OK to not define any nation groups at all.
-; name                 = name of the group (used adjectivally)
+; name          = name of the group (used adjectivally)
 ; hidden        = TRUE to not include this group in the "pick nation" dialog
 ;                 (for instance if it`s for use in a NationGroup requirement).
 ;                 Default FALSE.
-; match                = How much the AI will try to select a nation in the 
same
+; match         = How much the AI will try to select a nation in the same
 ;                 group
 
 [ngroup_barbarian]

Modified: trunk/data/civ1/nations.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/nations.ruleset?rev=33139&r1=33138&r2=33139&view=diff
==============================================================================
--- trunk/data/civ1/nations.ruleset     (original)
+++ trunk/data/civ1/nations.ruleset     Fri Jul  1 09:05:08 2016
@@ -65,7 +65,7 @@
 ; The first set defined is the one that is used by default. It is mandatory
 ; to have at least one, but if there is only one, it will be kept out of
 ; the user`s way.
-; name                 = Translatable name of the set presented in the UI.
+; name          = Translatable name of the set presented in the UI.
 ; rule_name     = Unique persistent name; this is also visible to users as
 ;                 the value of the "nationset" server option, and presented
 ;                 in "/list nationsets". It should thus be short, in lower
@@ -86,11 +86,11 @@
 ; These are more cosmetic than sets; they affect the "pick nation" dialog,
 ; random nation selection, and possibly ruleset behaviour.
 ; It`s OK to not define any nation groups at all.
-; name                 = name of the group (used adjectivally)
+; name          = name of the group (used adjectivally)
 ; hidden        = TRUE to not include this group in the "pick nation" dialog
 ;                 (for instance if it`s for use in a NationGroup requirement).
 ;                 Default FALSE.
-; match                = How much the AI will try to select a nation in the 
same
+; match         = How much the AI will try to select a nation in the same
 ;                 group
 
 [ngroup_ancient]

Modified: trunk/data/civ2/nations.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/nations.ruleset?rev=33139&r1=33138&r2=33139&view=diff
==============================================================================
--- trunk/data/civ2/nations.ruleset     (original)
+++ trunk/data/civ2/nations.ruleset     Fri Jul  1 09:05:08 2016
@@ -67,7 +67,7 @@
 ; The first set defined is the one that is used by default. It is mandatory
 ; to have at least one, but if there is only one, it will be kept out of
 ; the user`s way.
-; name                 = Translatable name of the set presented in the UI.
+; name          = Translatable name of the set presented in the UI.
 ; rule_name     = Unique persistent name; this is also visible to users as
 ;                 the value of the "nationset" server option, and presented
 ;                 in "/list nationsets". It should thus be short, in lower
@@ -88,11 +88,11 @@
 ; These are more cosmetic than sets; they affect the "pick nation" dialog,
 ; random nation selection, and possibly ruleset behaviour.
 ; It`s OK to not define any nation groups at all.
-; name                 = name of the group (used adjectivally)
+; name          =  name of the group (used adjectivally)
 ; hidden        = TRUE to not include this group in the "pick nation" dialog
 ;                 (for instance if it`s for use in a NationGroup requirement).
 ;                 Default FALSE.
-; match                = How much the AI will try to select a nation in the 
same
+; match         = How much the AI will try to select a nation in the same
 ;                 group
 
 [ngroup_ancient]

Modified: trunk/data/default/nationlist.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/default/nationlist.ruleset?rev=33139&r1=33138&r2=33139&view=diff
==============================================================================
--- trunk/data/default/nationlist.ruleset       (original)
+++ trunk/data/default/nationlist.ruleset       Fri Jul  1 09:05:08 2016
@@ -6,7 +6,7 @@
 ; The first set defined is the one that is used by default. It is mandatory
 ; to have at least one, but if there is only one, it will be kept out of
 ; the user`s way.
-; name                 = Translatable name of the set presented in the UI.
+; name          = Translatable name of the set presented in the UI.
 ; rule_name     = Unique persistent name; this is also visible to users as
 ;                 the value of the "nationset" server option, and presented
 ;                 in "/list nationsets". It should thus be short, in lower
@@ -49,11 +49,11 @@
 ; These are more cosmetic than sets; they affect the "pick nation" dialog,
 ; random nation selection, and possibly ruleset behaviour.
 ; It`s OK to not define any nation groups at all.
-; name                 = name of the group (used adjectivally)
+; name          = name of the group (used adjectivally)
 ; hidden        = TRUE to not include this group in the "pick nation" dialog
 ;                 (for instance if it`s for use in a NationGroup requirement).
 ;                 Default FALSE.
-; match                = How much the AI will try to select a nation in the 
same
+; match         = How much the AI will try to select a nation in the same
 ;                 group
 
 [ngroup_ancient]

Modified: trunk/data/ruledit/comments.txt
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/ruledit/comments.txt?rev=33139&r1=33138&r2=33139&view=diff
==============================================================================
--- trunk/data/ruledit/comments.txt     (original)
+++ trunk/data/ruledit/comments.txt     Fri Jul  1 09:05:08 2016
@@ -905,3 +905,46 @@
 ;\n\
 ; */ <-- avoid gettext warnings\n\
 "
+
+nations = "\
+\n\
+; See doc/README.nations for information on how to\n\
+; create nation rulesets, including style guidelines.\n\
+"
+
+nationgroups = "\
+\n\
+; Descriptions of nation groups\n\
+; These are more cosmetic than sets; they affect the \"pick nation\" dialog,\n\
+; random nation selection, and possibly ruleset behaviour.\n\
+; It`s OK to not define any nation groups at all.\n\
+; name          = name of the group (used adjectivally)\n\
+; hidden        = TRUE to not include this group in the \"pick nation\" 
dialog\n\
+;                 (for instance if it`s for use in a NationGroup 
requirement).\n\
+;                 Default FALSE.\n\
+; match         = How much the AI will try to select a nation in the same\n\
+;                 group\n\
+"
+
+nationsets = "\
+\n\
+; Descriptions of nation sets\n\
+; These are self-contained subsets of the available nations; one of these\n\
+; can be chosen in pregame with the \"nationset\" option. No nations\n\
+; outside the selected subset will be used.\n\
+; The first set defined is the one that is used by default. It is mandatory\n\
+; to have at least one, but if there is only one, it will be kept out of\n\
+; the user`s way.\n\
+; name          = Translatable name of the set presented in the UI.\n\
+; rule_name     = Unique persistent name; this is also visible to users as\n\
+;                 the value of the \"nationset\" server option, and 
presented\n\
+;                 in \"/list nationsets\". It should thus be short, in lower\n\
+;                 case, and not contain spaces or punctuation.\n\
+;                 The same saved \"nationset\" setting may be used for 
multiple\n\
+;                 rulesets, so if your custom ruleset has any set which\n\
+;                 contains all of its nations, it is useful to give it a\n\
+;                 rule_name of \"all\" so that users can specify that they\n\
+;                 always want the choice of all available nations by\n\
+;                 default.\n\
+; description   = Optional short user description of this set.\n\
+"

Modified: trunk/tools/ruleutil/comments.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruleutil/comments.c?rev=33139&r1=33138&r2=33139&view=diff
==============================================================================
--- trunk/tools/ruleutil/comments.c     (original)
+++ trunk/tools/ruleutil/comments.c     Fri Jul  1 09:05:08 2016
@@ -41,6 +41,9 @@
   char *goods;
   char *enablers;
   char *specialists;
+  char *nations;
+  char *nationgroups;
+  char *nationsets;
 } comments_storage;
 
 /**************************************************************************
@@ -81,6 +84,10 @@
   comments_storage.goods = fc_strdup(secfile_lookup_str(comment_file, 
"typedoc.goods"));
   comments_storage.enablers = fc_strdup(secfile_lookup_str(comment_file, 
"typedoc.enablers"));
   comments_storage.specialists = fc_strdup(secfile_lookup_str(comment_file, 
"typedoc.specialists"));
+  comments_storage.nations = fc_strdup(secfile_lookup_str(comment_file, 
"typedoc.nations"));
+  comments_storage.nationgroups = fc_strdup(secfile_lookup_str(comment_file,
+                                                               
"typedoc.nationgroups"));
+  comments_storage.nationsets = fc_strdup(secfile_lookup_str(comment_file, 
"typedoc.nationsets"));
 
   secfile_check_unused(comment_file);
   secfile_destroy(comment_file);
@@ -253,3 +260,28 @@
 {
   comment_write(sfile, comments_storage.specialists, "Specialists");
 }
+
+/**************************************************************************
+  Write nations header.
+**************************************************************************/
+void comment_nations(struct section_file *sfile)
+{
+  comment_write(sfile, comments_storage.nations, "Nations");
+}
+
+/**************************************************************************
+  Write nationgroups header.
+**************************************************************************/
+void comment_nationgroups(struct section_file *sfile)
+{
+  comment_write(sfile, comments_storage.nationgroups, "Nationgroups");
+}
+
+/**************************************************************************
+  Write nationsets header.
+**************************************************************************/
+void comment_nationsets(struct section_file *sfile)
+{
+  comment_write(sfile, comments_storage.nationsets, "Nationsets");
+}
+

Modified: trunk/tools/ruleutil/comments.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruleutil/comments.h?rev=33139&r1=33138&r2=33139&view=diff
==============================================================================
--- trunk/tools/ruleutil/comments.h     (original)
+++ trunk/tools/ruleutil/comments.h     Fri Jul  1 09:05:08 2016
@@ -41,6 +41,9 @@
 void comment_goods(struct section_file *sfile);
 void comment_enablers(struct section_file *sfile);
 void comment_specialists(struct section_file *sfile);
+void comment_nationsets(struct section_file *sfile);
+void comment_nationgroups(struct section_file *sfile);
+void comment_nations(struct section_file *sfile);
 
 #ifdef __cplusplus
 }

Modified: trunk/tools/ruleutil/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruleutil/rulesave.c?rev=33139&r1=33138&r2=33139&view=diff
==============================================================================
--- trunk/tools/ruleutil/rulesave.c     (original)
+++ trunk/tools/ruleutil/rulesave.c     Fri Jul  1 09:05:08 2016
@@ -1645,6 +1645,8 @@
     if (game.server.ruledit.embedded_nations != NULL) {
       int sect_idx;
 
+      comment_nations(sfile);
+
       for (sect_idx = 0; sect_idx < game.server.ruledit.embedded_nations_count;
            sect_idx++) {
         struct nation_type *pnat
@@ -1661,6 +1663,8 @@
   } else {
     int sect_idx = 0;
 
+    comment_nationsets(sfile);
+
     nation_sets_iterate(pset) {
       char path[512];
 
@@ -1673,6 +1677,8 @@
       secfile_insert_str(sfile, nation_set_description(pset), 
"%s.description", path);
     } nation_sets_iterate_end;
 
+    comment_nationgroups(sfile);
+
     sect_idx = 0;
     nation_groups_iterate(pgroup) {
       char path[512];
@@ -1686,6 +1692,8 @@
         secfile_insert_bool(sfile, pgroup->hidden, "%s.hidden", path);
       }
     } nation_groups_iterate_end;
+
+    comment_nations(sfile);
 
     sect_idx = 0;
     nations_iterate(pnat) {


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to