Author: sveinung
Date: Wed Jun  8 16:34:23 2016
New Revision: 32801

URL: http://svn.gna.org/viewcvs/freeciv?rev=32801&view=rev
Log:
Help: list what actions blocks an action.

The auto generated help text of a unit contains what actions it can do. Each
action has a bullet point. Add a sub bullet point about what actions can
block it.

See patch #7247

Modified:
    trunk/client/helpdata.c

Modified: trunk/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=32801&r1=32800&r2=32801&view=diff
==============================================================================
--- trunk/client/helpdata.c     (original)
+++ trunk/client/helpdata.c     Wed Jun  8 16:34:23 2016
@@ -4338,6 +4338,8 @@
 
     if (utype_can_do_action(utype, act)) {
       const char *target_adjective;
+      const char const *blockers[ACTION_COUNT];
+      int i = 0;
 
       /* Generic action information. */
       cat_snprintf(buf, bufsz,
@@ -4430,6 +4432,35 @@
       default:
         /* No action specific details. */
         break;
+      }
+
+      action_iterate(blocker) {
+        if (!utype_can_do_action(utype, blocker)) {
+          /* Can't block since never legal. */
+          continue;
+        }
+
+        if (action_id_would_be_blocked_by(act, blocker)) {
+          char *quoted = fc_malloc(MAX_LEN_NAME);
+
+          fc_snprintf(quoted, MAX_LEN_NAME,
+                      /* TRANS: %s is an action that can block another. */
+                      _("\'%s\'"), action_get_ui_name(blocker));
+          blockers[i] = quoted;
+
+          i++;
+        }
+      } action_iterate_end;
+
+      if (i > 0) {
+        struct astring blist = ASTRING_INIT;
+
+        cat_snprintf(buf, bufsz,
+                     /* TRANS: %s is a list of actions separated by "or". */
+                     _("  * can't be done if %s is legal.\n"),
+                     astr_build_or_list(&blist, blockers, i));
+
+        astr_free(&blist);
       }
     }
   } action_iterate_end;


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

Reply via email to