Author: sveinung
Date: Wed Jun  8 16:34:15 2016
New Revision: 32800

URL: http://svn.gna.org/viewcvs/freeciv?rev=32800&view=rev
Log:
Help: specify if target must be foreign/domestic.

The auto generated help text of a unit contains what actions it can do. Each
action has a bullet point. It contains the action's target type.

Some action can only be done to foreign targets. Some actions can only be
done to domestic targets. Some actions can be done to both. This information
is significant enough to add to the help text.

Move the action's target kind to a sub bullet point. This gives room to
specify when the target must be foreign or domestic.

See patch #7246

Modified:
    trunk/client/helpdata.c

Modified: trunk/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=32800&r1=32799&r2=32800&view=diff
==============================================================================
--- trunk/client/helpdata.c     (original)
+++ trunk/client/helpdata.c     Wed Jun  8 16:34:15 2016
@@ -4337,24 +4337,40 @@
     }
 
     if (utype_can_do_action(utype, act)) {
+      const char *target_adjective;
+
       /* Generic action information. */
+      cat_snprintf(buf, bufsz,
+                   /* TRANS: %s is the action's ruleset defined ui name */
+                   _("* Can do the action \'%s\'.\n"),
+                   action_get_ui_name(act));
+
       switch (action_get_target_kind(act)) {
       case ATK_SELF:
-        cat_snprintf(buf, bufsz,
-                     /* TRANS: %s is the action's ruleset defined ui name */
-                     _("* Can do the action \'%s\'.\n"),
-                     action_get_ui_name(act));
+        /* No target. */
         break;
       default:
-        cat_snprintf(buf, bufsz,
-                     /* TRANS: the first %s is the action's ruleset
-                      * defined ui name and the next %s is the name of
-                      * its target kind. */
-                     _("* Can do the action \'%s\' to some %s.\n"),
-                     action_get_ui_name(act),
+        if (!can_utype_do_act_if_tgt_diplrel(utype, act,
+                                             DRO_FOREIGN, TRUE)) {
+          /* TRANS: describes the target of an action. */
+          target_adjective = _("domestic ");
+        } else if (!can_utype_do_act_if_tgt_diplrel(utype, act,
+                                                    DRO_FOREIGN, FALSE)) {
+          /* TRANS: describes the target of an action. */
+          target_adjective = _("foreign ");
+        } else {
+          /* Both foreign and domestic targets are acceptable. */
+          target_adjective = "";
+        }
+
+        cat_snprintf(buf, bufsz,
+                     /* TRANS: The first %s may be an adjective (that
+                      * includes a space). The next is the name of its
+                      * target kind. */
+                     _("  * is done to %s%s.\n"),
+                     target_adjective,
                      _(action_target_kind_name(
                          action_get_target_kind(act))));
-        break;
       }
 
       /* Custom action specific information. */


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

Reply via email to