Author: jtn
Date: Tue Apr  7 09:29:18 2015
New Revision: 28740

URL: http://svn.gna.org/viewcvs/freeciv?rev=28740&view=rev
Log:
Automatically document things allowed/prevented by extras/nations.

See gna patch #5984.

Modified:
    branches/S2_6/client/helpdata.c

Modified: branches/S2_6/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/helpdata.c?rev=28740&r1=28739&r2=28740&view=diff
==============================================================================
--- branches/S2_6/client/helpdata.c     (original)
+++ branches/S2_6/client/helpdata.c     Tue Apr  7 09:29:18 2015
@@ -3251,7 +3251,6 @@
                   "to build %s units.\n"),
                  advance_name_translation(u->require_advance),
                 utype_name_translation(u));
-    cat_snprintf(buf, bufsz, "  ");
   }
 
   insert_allows(&source, buf + strlen(buf), bufsz - strlen(buf));
@@ -4440,6 +4439,10 @@
 {
   struct base_type *pbase;
   struct road_type *proad;
+  struct universal source = {
+    .kind = VUT_EXTRA,
+    .value = {.extra = pextra}
+  };
 
   fc_assert_ret(NULL != buf && 0 < bufsz);
   buf[0] = '\0';
@@ -4466,6 +4469,8 @@
       cat_snprintf(buf, bufsz, "%s\n\n", _(text));
     } strvec_iterate_end;
   }
+
+  insert_allows(&source, buf + strlen(buf), bufsz - strlen(buf));
 
   if (is_extra_caused_by(pextra, EC_POLLUTION)) {
     CATLSTR(buf, bufsz,
@@ -5403,6 +5408,11 @@
 void helptext_nation(char *buf, size_t bufsz, struct nation_type *pnation,
                     const char *user_text)
 {
+  struct universal source = {
+    .kind = VUT_NATION,
+    .value = {.nation = pnation}
+  };
+
   fc_assert_ret(NULL != buf && 0 < bufsz);
   buf[0] = '\0';
 
@@ -5523,8 +5533,15 @@
     astr_free(&list);
   }
 
+  if (buf[0] != '\0') {
+    CATLSTR(buf, bufsz, "\n");
+  }
+  insert_allows(&source, buf + strlen(buf), bufsz - strlen(buf));
+
   if (user_text && user_text[0] != '\0') {
-    CATLSTR(buf, bufsz, "\n");
+    if (buf[0] != '\0') {
+      CATLSTR(buf, bufsz, "\n");
+    }
     CATLSTR(buf, bufsz, user_text);
   }
 }


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

Reply via email to