Author: cazfi
Date: Sat Feb 14 17:34:48 2015
New Revision: 28130

URL: http://svn.gna.org/viewcvs/freeciv?rev=28130&view=rev
Log:
Instead of having separate line for each buildable extra in unit help, have 
them grouped by
the activity.

See patch #5797

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=28130&r1=28129&r2=28130&view=diff
==============================================================================
--- branches/S2_5/client/helpdata.c     (original)
+++ branches/S2_5/client/helpdata.c     Sat Feb 14 17:34:48 2015
@@ -2621,14 +2621,22 @@
   }
   if (utype_has_flag(utype, UTYF_SETTLERS)) {
     char buf2[1024];
+    struct astring extras_and = ASTRING_INIT;
+    struct strvec *extras_vec = strvec_new();
 
     /* Roads, rail, mines, irrigation. */
     road_type_iterate(proad) {
       if (help_is_road_buildable(proad, utype)) {
-        cat_snprintf(buf, bufsz, _("* Can build %s on tiles.\n"),
-                     road_name_translation(proad));
+        strvec_append(extras_vec, road_name_translation(proad));
       }
     } road_type_iterate_end;
+    if (strvec_size(extras_vec) > 0) {
+      strvec_to_and_list(extras_vec, &extras_and);
+      /* TRANS: %s is list of extra types separated by ',' and 'and' */
+      cat_snprintf(buf, bufsz, _("* Can build %s on tiles.\n"),
+                   astr_str(&extras_and));
+      strvec_clear(extras_vec);
+    }
 
     if (effect_cumulative_max(EFT_MINING_POSSIBLE, utype) > 0) {
       CATLSTR(buf, bufsz, _("* Can build mines on tiles.\n"));
@@ -2663,10 +2671,15 @@
 
     base_type_iterate(pbase) {
       if (help_is_base_buildable(pbase, utype)) {
-        cat_snprintf(buf, bufsz, _("* Can build %s on tiles.\n"),
-                     base_name_translation(pbase));
+        strvec_append(extras_vec, base_name_translation(pbase));
       }
     } base_type_iterate_end;
+    if (strvec_size(extras_vec) > 0) {
+      strvec_to_and_list(extras_vec, &extras_and);
+      cat_snprintf(buf, bufsz, _("* Can build %s on tiles.\n"),
+                   astr_str(&extras_and));
+      strvec_clear(extras_vec);
+    }
 
     /* Pollution, fallout. */
     CATLSTR(buf, bufsz, _("* Can clean pollution from tiles.\n"));


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

Reply via email to