Author: jtn
Date: Tue Apr  7 09:32:58 2015
New Revision: 28742

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

See gna patch #5984.

Modified:
    branches/S2_5/client/helpdata.c

Modified: branches/S2_5/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/helpdata.c?rev=28742&r1=28741&r2=28742&view=diff
==============================================================================
--- branches/S2_5/client/helpdata.c     (original)
+++ branches/S2_5/client/helpdata.c     Tue Apr  7 09:32:58 2015
@@ -2105,7 +2105,6 @@
                 advance_name_for_player(pplayer,
                                         advance_number(u->require_advance)),
                 utype_name_translation(u));
-    cat_snprintf(buf, bufsz, "  ");
   }
 
   insert_allows(&source, buf + strlen(buf), bufsz - strlen(buf));
@@ -3245,6 +3244,11 @@
 void helptext_base(char *buf, size_t bufsz, struct player *pplayer,
                    const char *user_text, struct base_type *pbase)
 {
+  struct universal source = {
+    .kind = VUT_BASE,
+    .value = {.base = pbase}
+  };
+
   fc_assert_ret(NULL != buf && 0 < bufsz);
   buf[0] = '\0';
 
@@ -3270,6 +3274,8 @@
     } requirement_vector_iterate_end;
     CATLSTR(buf, bufsz, "\n");
   }
+
+  insert_allows(&source, buf + strlen(buf), bufsz - strlen(buf));
 
   {
     const char *classes[uclass_count()];
@@ -3390,6 +3396,11 @@
 void helptext_road(char *buf, size_t bufsz, struct player *pplayer,
                    const char *user_text, struct road_type *proad)
 {
+  struct universal source = {
+    .kind = VUT_ROAD,
+    .value = {.road = proad}
+  };
+
   fc_assert_ret(NULL != buf && 0 < bufsz);
   buf[0] = '\0';
 
@@ -3415,6 +3426,8 @@
     } requirement_vector_iterate_end;
     CATLSTR(buf, bufsz, "\n");
   }
+
+  insert_allows(&source, buf + strlen(buf), bufsz - strlen(buf));
 
   {
     const char *classes[uclass_count()];
@@ -4254,6 +4267,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';
 
@@ -4374,8 +4392,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