Author: sveinung
Date: Wed Jan 14 14:01:15 2015
New Revision: 27674

URL: http://svn.gna.org/viewcvs/freeciv?rev=27674&view=rev
Log:
Ruledit: Save help text less user flags.

The help text of a ruleset defined user flag is optional.

See bug #23178

Modified:
    trunk/tools/ruledit/rulesave.c

Modified: trunk/tools/ruledit/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/rulesave.c?rev=27674&r1=27673&r2=27674&view=diff
==============================================================================
--- trunk/tools/ruledit/rulesave.c      (original)
+++ trunk/tools/ruledit/rulesave.c      Wed Jan 14 14:01:15 2015
@@ -1362,11 +1362,15 @@
   }
 
   for (i = 0; i < MAX_NUM_USER_TECH_FLAGS; i++) {
-    const char *flagname = tech_flag_id_name(i + TECH_USER_1);
+    const char *flagname = tech_flag_id_name_cb(i + TECH_USER_1);
     const char *helptxt = tech_flag_helptxt(i + TECH_USER_1);
 
-    if (flagname != NULL && helptxt != NULL) {
+    if (flagname != NULL) {
       secfile_insert_str(sfile, flagname, "control.flags%d.name", i);
+
+      /* Save the user flag help text even when it is undefined. That makes
+       * the formating code happy. The resulting "" is ignored when the
+       * ruleset is loaded. */
       secfile_insert_str(sfile, helptxt, "control.flags%d.helptxt", i);
     }
   }
@@ -1434,11 +1438,15 @@
   }
 
   for (i = 0; i < MAX_NUM_USER_TER_FLAGS; i++) {
-    const char *flagname = terrain_flag_id_name(i + TER_USER_1);
+    const char *flagname = terrain_flag_id_name_cb(i + TER_USER_1);
     const char *helptxt = terrain_flag_helptxt(i + TER_USER_1);
 
-    if (flagname != NULL && helptxt != NULL) {
+    if (flagname != NULL) {
       secfile_insert_str(sfile, flagname, "control.flags%d.name", i);
+
+      /* Save the user flag help text even when it is undefined. That makes
+       * the formating code happy. The resulting "" is ignored when the
+       * ruleset is loaded. */
       secfile_insert_str(sfile, helptxt, "control.flags%d.helptxt", i);
     }
   }
@@ -1948,11 +1956,15 @@
   }
 
   for (i = 0; i < MAX_NUM_USER_UNIT_FLAGS; i++) {
-    const char *flagname = unit_type_flag_id_name(i + UTYF_USER_FLAG_1);
+    const char *flagname = unit_type_flag_id_name_cb(i + UTYF_USER_FLAG_1);
     const char *helptxt = unit_type_flag_helptxt(i + UTYF_USER_FLAG_1);
 
-    if (flagname != NULL && helptxt != NULL) {
+    if (flagname != NULL) {
       secfile_insert_str(sfile, flagname, "control.flags%d.name", i);
+
+      /* Save the user flag help text even when it is undefined. That makes
+       * the formating code happy. The resulting "" is ignored when the
+       * ruleset is loaded. */
       secfile_insert_str(sfile, helptxt, "control.flags%d.helptxt", i);
     }
   }


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

Reply via email to