Author: cazfi
Date: Sun Apr 10 16:35:36 2016
New Revision: 32339

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

See patch #7090

Modified:
    trunk/data/alien/buildings.ruleset
    trunk/data/civ1/buildings.ruleset
    trunk/data/civ2/buildings.ruleset
    trunk/data/civ2civ3/buildings.ruleset
    trunk/data/classic/buildings.ruleset
    trunk/data/experimental/buildings.ruleset
    trunk/data/multiplayer/buildings.ruleset
    trunk/data/ruledit/comments.txt
    trunk/data/sandbox/buildings.ruleset
    trunk/data/stub/buildings.ruleset
    trunk/tools/ruledit/comments.c
    trunk/tools/ruledit/comments.h
    trunk/tools/ruledit/rulesave.c

Modified: trunk/data/alien/buildings.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/buildings.ruleset?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/data/alien/buildings.ruleset  (original)
+++ trunk/data/alien/buildings.ruleset  Sun Apr 10 16:35:36 2016
@@ -21,8 +21,8 @@
 ; Below: The individual buildings, one per section.
 ; (Buildings = City Improvements and Wonders)
 ;
-; The actual tag used (the * in [building_*]) does not matter, except 
-; it must be unique within this file, and it may be used in debug 
+; The actual tag used (the * in [building_*]) does not matter, except
+; it must be unique within this file, and it may be used in debug
 ; output when reading this file.
 ;
 ; Notes:

Modified: trunk/data/civ1/buildings.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/buildings.ruleset?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/data/civ1/buildings.ruleset   (original)
+++ trunk/data/civ1/buildings.ruleset   Sun Apr 10 16:35:36 2016
@@ -18,12 +18,45 @@
 ; Below: The individual buildings, one per section.
 ; (Buildings = City Improvements and Wonders)
 ;
-; The actual tag used (the * in [building_*]) does not matter, except 
-; it must be unique within this file, and it may be used in debug 
+; The actual tag used (the * in [building_*]) does not matter, except
+; it must be unique within this file, and it may be used in debug
 ; output when reading this file.
 ;
-; /*** For details of this file's format, ***/
-; /*** see the classic buildings.ruleset. ***/
+; Notes:
+;
+; name          = translatable name as seen by user
+; rule_name     = (optional) name for savegames, rulesets etc; if not
+;                 present, 'name' is used. Since the name used in savegames
+;                 must not change, use this when renaming a building after a
+;                 ruleset has been released.
+; genus                = genus; one of:
+;                 "GreatWonder", "SmallWonder", "Improvement", "Special".
+; reqs         = requirements to build the building (see effects.ruleset
+;                and README.effects for help on requirements)
+; graphic      = icon of improvement (used in city dialog)
+; graphic_alt  = alternate icon of improvement
+; obsolete_by  = requirements for the building to become obsolete
+; build_cost   = production shields required to build
+; upkeep       = monetary upkeep value
+; sabotage     = percent chance of diplomat sabotage being successful
+; flags         = special flag strings
+;
+; ** Building flags **
+; "VisibleByOthers"  = Anyone who can see your city knows whether it has
+;                      this improvement. (Great and small wonders are
+;                      always visible.)
+; "SaveSmallWonder"  = If you lose the city with this building in, and the
+;                      "savepalace" server setting is enabled, another will
+;                      be built for free in a random city.
+;                      Should only be used with genus "SmallWonder".
+; "Gold"             = Not a real building; production turned into gold
+;                      indefinitely (capitalization/coinage).
+;                      Genus should be "Special".
+; "DisasterProof"    = Disasters never destroy this building. Is meaningful
+;                      only for genus "Improvement" buildings as others are
+;                      automatically disaster proof.
+;
+; */ <-- avoid gettext warnings
 
 [building_aqueduct]
 name           = _("Aqueduct")

Modified: trunk/data/civ2/buildings.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/buildings.ruleset?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/data/civ2/buildings.ruleset   (original)
+++ trunk/data/civ2/buildings.ruleset   Sun Apr 10 16:35:36 2016
@@ -15,15 +15,50 @@
 options="+Freeciv-ruleset-Devel-2015.January.14"
 format_version=10
 
+; /* <-- avoid gettext warnings
+;
 ; Below: The individual buildings, one per section.
 ; (Buildings = City Improvements and Wonders)
 ;
-; The actual tag used (the * in [building_*]) does not matter, except 
-; it must be unique within this file, and it may be used in debug 
+; The actual tag used (the * in [building_*]) does not matter, except
+; it must be unique within this file, and it may be used in debug
 ; output when reading this file.
 ;
-; /*** For details of this file's format, ***/
-; /*** see the classic buildings.ruleset. ***/
+; Notes:
+;
+; name          = translatable name as seen by user
+; rule_name     = (optional) name for savegames, rulesets etc; if not
+;                 present, 'name' is used. Since the name used in savegames
+;                 must not change, use this when renaming a building after a
+;                 ruleset has been released.
+; genus                = genus; one of:
+;                 "GreatWonder", "SmallWonder", "Improvement", "Special".
+; reqs         = requirements to build the building (see effects.ruleset
+;                and README.effects for help on requirements)
+; graphic      = icon of improvement (used in city dialog)
+; graphic_alt  = alternate icon of improvement
+; obsolete_by  = requirements for the building to become obsolete
+; build_cost   = production shields required to build
+; upkeep       = monetary upkeep value
+; sabotage     = percent chance of diplomat sabotage being successful
+; flags         = special flag strings
+;
+; ** Building flags **
+; "VisibleByOthers"  = Anyone who can see your city knows whether it has
+;                      this improvement. (Great and small wonders are
+;                      always visible.)
+; "SaveSmallWonder"  = If you lose the city with this building in, and the
+;                      "savepalace" server setting is enabled, another will
+;                      be built for free in a random city.
+;                      Should only be used with genus "SmallWonder".
+; "Gold"             = Not a real building; production turned into gold
+;                      indefinitely (capitalization/coinage).
+;                      Genus should be "Special".
+; "DisasterProof"    = Disasters never destroy this building. Is meaningful
+;                      only for genus "Improvement" buildings as others are
+;                      automatically disaster proof.
+;
+; */ <-- avoid gettext warnings
 
 [building_airport]
 name           = _("Airport")

Modified: trunk/data/civ2civ3/buildings.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/buildings.ruleset?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/data/civ2civ3/buildings.ruleset       (original)
+++ trunk/data/civ2civ3/buildings.ruleset       Sun Apr 10 16:35:36 2016
@@ -20,8 +20,8 @@
 ; Below: The individual buildings, one per section.
 ; (Buildings = City Improvements and Wonders)
 ;
-; The actual tag used (the * in [building_*]) does not matter, except 
-; it must be unique within this file, and it may be used in debug 
+; The actual tag used (the * in [building_*]) does not matter, except
+; it must be unique within this file, and it may be used in debug
 ; output when reading this file.
 ;
 ; Notes:

Modified: trunk/data/classic/buildings.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/buildings.ruleset?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/data/classic/buildings.ruleset        (original)
+++ trunk/data/classic/buildings.ruleset        Sun Apr 10 16:35:36 2016
@@ -20,8 +20,8 @@
 ; Below: The individual buildings, one per section.
 ; (Buildings = City Improvements and Wonders)
 ;
-; The actual tag used (the * in [building_*]) does not matter, except 
-; it must be unique within this file, and it may be used in debug 
+; The actual tag used (the * in [building_*]) does not matter, except
+; it must be unique within this file, and it may be used in debug
 ; output when reading this file.
 ;
 ; Notes:

Modified: trunk/data/experimental/buildings.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/buildings.ruleset?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/data/experimental/buildings.ruleset   (original)
+++ trunk/data/experimental/buildings.ruleset   Sun Apr 10 16:35:36 2016
@@ -22,8 +22,8 @@
 ; Below: The individual buildings, one per section.
 ; (Buildings = City Improvements and Wonders)
 ;
-; The actual tag used (the * in [building_*]) does not matter, except 
-; it must be unique within this file, and it may be used in debug 
+; The actual tag used (the * in [building_*]) does not matter, except
+; it must be unique within this file, and it may be used in debug
 ; output when reading this file.
 ;
 ; Notes:

Modified: trunk/data/multiplayer/buildings.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/buildings.ruleset?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/data/multiplayer/buildings.ruleset    (original)
+++ trunk/data/multiplayer/buildings.ruleset    Sun Apr 10 16:35:36 2016
@@ -19,8 +19,8 @@
 ; Below: The individual buildings, one per section.
 ; (Buildings = City Improvements and Wonders)
 ;
-; The actual tag used (the * in [building_*]) does not matter, except 
-; it must be unique within this file, and it may be used in debug 
+; The actual tag used (the * in [building_*]) does not matter, except
+; it must be unique within this file, and it may be used in debug
 ; output when reading this file.
 ;
 ; Notes:

Modified: trunk/data/ruledit/comments.txt
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/ruledit/comments.txt?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/data/ruledit/comments.txt     (original)
+++ trunk/data/ruledit/comments.txt     Sun Apr 10 16:35:36 2016
@@ -14,3 +14,54 @@
 ; Note that the freeciv AI may not cope well with anything more\n\
 ; than minor changes.\n\
 "
+
+[typedoc]
+; This section contains comments documenting different ruleset object types.
+
+buildings = "\
+\n\
+; /* <-- avoid gettext warnings\n\
+;\n\
+; Below: The individual buildings, one per section.\n\
+; (Buildings = City Improvements and Wonders)\n\
+;\n\
+; The actual tag used (the * in [building_*]) does not matter, except\n\
+; it must be unique within this file, and it may be used in debug\n\
+; output when reading this file.\n\
+;\n\
+; Notes:\n\
+;\n\
+; name          = translatable name as seen by user\n\
+; rule_name     = (optional) name for savegames, rulesets etc; if not\n\
+;                 present, 'name' is used. Since the name used in savegames\n\
+;                 must not change, use this when renaming a building after a\n\
+;                 ruleset has been released.\n\
+; genus         = genus; one of:\n\
+;                 \"GreatWonder\", \"SmallWonder\", \"Improvement\", 
\"Special\".\n\
+; reqs          = requirements to build the building (see effects.ruleset\n\
+;                 and README.effects for help on requirements)\n\
+; graphic       = icon of improvement (used in city dialog)\n\
+; graphic_alt   = alternate icon of improvement\n\
+; obsolete_by   = requirements for the building to become obsolete\n\
+; build_cost    = production shields required to build\n\
+; upkeep        = monetary upkeep value\n\
+; sabotage      = percent chance of diplomat sabotage being successful\n\
+; flags         = special flag strings\n\
+;\n\
+; ** Building flags **\n\
+; \"VisibleByOthers\"  = Anyone who can see your city knows whether it has\n\
+;                      this improvement. (Great and small wonders are\n\
+;                      always visible.)\n\
+; \"SaveSmallWonder\"  = If you lose the city with this building in, and the\n\
+;                      \"savepalace\" server setting is enabled, another 
will\n\
+;                      be built for free in a random city.\n\
+;                      Should only be used with genus \"SmallWonder\".\n\
+; \"Gold\"             = Not a real building; production turned into gold\n\
+;                      indefinitely (capitalization/coinage).\n\
+;                      Genus should be \"Special\".\n\
+; \"DisasterProof\"    = Disasters never destroy this building. Is 
meaningful\n\
+;                      only for genus \"Improvement\" buildings as others 
are\n\
+;                      automatically disaster proof.\n\
+;\n\
+; */ <-- avoid gettext warnings\n\
+"

Modified: trunk/data/sandbox/buildings.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/buildings.ruleset?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/data/sandbox/buildings.ruleset        (original)
+++ trunk/data/sandbox/buildings.ruleset        Sun Apr 10 16:35:36 2016
@@ -20,8 +20,8 @@
 ; Below: The individual buildings, one per section.
 ; (Buildings = City Improvements and Wonders)
 ;
-; The actual tag used (the * in [building_*]) does not matter, except 
-; it must be unique within this file, and it may be used in debug 
+; The actual tag used (the * in [building_*]) does not matter, except
+; it must be unique within this file, and it may be used in debug
 ; output when reading this file.
 ;
 ; Notes:

Modified: trunk/data/stub/buildings.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/stub/buildings.ruleset?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/data/stub/buildings.ruleset   (original)
+++ trunk/data/stub/buildings.ruleset   Sun Apr 10 16:35:36 2016
@@ -11,8 +11,8 @@
 ; Below: The individual buildings, one per section.
 ; (Buildings = City Improvements and Wonders)
 ;
-; The actual tag used (the * in [building_*]) does not matter, except 
-; it must be unique within this file, and it may be used in debug 
+; The actual tag used (the * in [building_*]) does not matter, except
+; it must be unique within this file, and it may be used in debug
 ; output when reading this file.
 ;
 ; Notes:

Modified: trunk/tools/ruledit/comments.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/comments.c?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/tools/ruledit/comments.c      (original)
+++ trunk/tools/ruledit/comments.c      Sun Apr 10 16:35:36 2016
@@ -24,6 +24,7 @@
 
 static struct {
   char *file_header;
+  char *buildings;
 } comments_storage;
 
 /**************************************************************************
@@ -46,6 +47,7 @@
   }
 
   comments_storage.file_header = fc_strdup(secfile_lookup_str(comment_file, 
"common.header"));
+  comments_storage.buildings = fc_strdup(secfile_lookup_str(comment_file, 
"typedoc.buildings"));
 
   secfile_check_unused(comment_file);
   secfile_destroy(comment_file);
@@ -62,9 +64,31 @@
 }
 
 /**************************************************************************
+  Generic comment writing function with some error checking.
+**************************************************************************/
+static void comment_write(struct section_file *sfile, const char *comment,
+                          const char *name)
+{
+  if (comment == NULL) {
+    log_error("Comment for %s missing.", name);
+    return;
+  }
+
+  secfile_insert_long_comment(sfile, comment);
+}
+
+/**************************************************************************
   Write file header.
 **************************************************************************/
 void comment_file_header(struct section_file *sfile)
 {
-  secfile_insert_long_comment(sfile, comments_storage.file_header);
+  comment_write(sfile, comments_storage.file_header, "File header");
 }
+
+/**************************************************************************
+  Write buildings header.
+**************************************************************************/
+void comment_buildings(struct section_file *sfile)
+{
+  comment_write(sfile, comments_storage.buildings, "Buildings");
+}

Modified: trunk/tools/ruledit/comments.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/comments.h?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/tools/ruledit/comments.h      (original)
+++ trunk/tools/ruledit/comments.h      Sun Apr 10 16:35:36 2016
@@ -24,6 +24,8 @@
 
 void comment_file_header(struct section_file *sfile);
 
+void comment_buildings(struct section_file *sfile);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: trunk/tools/ruledit/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/rulesave.c?rev=32339&r1=32338&r2=32339&view=diff
==============================================================================
--- trunk/tools/ruledit/rulesave.c      (original)
+++ trunk/tools/ruledit/rulesave.c      Sun Apr 10 16:35:36 2016
@@ -382,6 +382,8 @@
   if (sfile == NULL) {
     return FALSE;
   }
+
+  comment_buildings(sfile);
 
   sect_idx = 0;
   improvement_iterate(pb) {


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

Reply via email to