Author: sveinung
Date: Thu Mar 10 14:14:55 2016
New Revision: 32222

URL: http://svn.gna.org/viewcvs/freeciv?rev=32222&view=rev
Log:
No auto generated help for quiet actions.

Introduce the action property "quiet". If an action is declared quiet no
help texts will be auto generated about what enables and what disables it.
See also the "quiet" property of requirements and combat bonuses.

See patch #7046

Modified:
    branches/S2_6/client/helpdata.c
    branches/S2_6/client/packhand.c
    branches/S2_6/common/actions.c
    branches/S2_6/common/actions.h
    branches/S2_6/common/packets.def
    branches/S2_6/data/alien/game.ruleset
    branches/S2_6/data/civ1/game.ruleset
    branches/S2_6/data/civ2/game.ruleset
    branches/S2_6/data/civ2civ3/game.ruleset
    branches/S2_6/data/classic/game.ruleset
    branches/S2_6/data/experimental/game.ruleset
    branches/S2_6/data/multiplayer/game.ruleset
    branches/S2_6/data/sandbox/game.ruleset
    branches/S2_6/data/stub/game.ruleset
    branches/S2_6/fc_version
    branches/S2_6/server/ruleset.c
    branches/S2_6/tools/ruledit/rulesave.c

Modified: branches/S2_6/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/helpdata.c?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/client/helpdata.c     (original)
+++ branches/S2_6/client/helpdata.c     Thu Mar 10 14:14:55 2016
@@ -4293,6 +4293,11 @@
     }
   }
   action_iterate(act) {
+    if (action_by_number(act)->quiet) {
+      /* The ruleset documents this action it self. */
+      continue;
+    }
+    
     if (action_get_actor_kind(act) != AAK_UNIT) {
       continue;
     }
@@ -4340,6 +4345,11 @@
   } action_iterate_end;
   action_iterate(act) {
     bool vulnerable;
+
+    if (action_by_number(act)->quiet) {
+      /* The ruleset documents this action it self. */
+      continue;
+    }
 
     /* Not relevant */
     if (action_get_target_kind(act) != ATK_UNIT) {
@@ -5673,6 +5683,11 @@
 
   /* Action immunity */
   action_iterate(act) {
+    if (action_by_number(act)->quiet) {
+      /* The ruleset documents this action it self. */
+      continue;
+    }
+
     if (action_immune_government(gov, act)) {
       cat_snprintf(buf, bufsz,
                    _("* Makes it impossible to do the action \'%s\'"

Modified: branches/S2_6/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/packhand.c?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/client/packhand.c     (original)
+++ branches/S2_6/client/packhand.c     Thu Mar 10 14:14:55 2016
@@ -3674,6 +3674,7 @@
   act = action_by_number(p->id);
 
   sz_strlcpy(act->ui_name, p->ui_name);
+  act->quiet = p->quiet;
 }
 
 /****************************************************************************

Modified: branches/S2_6/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/actions.c?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/common/actions.c      (original)
+++ branches/S2_6/common/actions.c      Thu Mar 10 14:14:55 2016
@@ -174,9 +174,10 @@
   action->target_kind = target_kind;
   action->hostile = hostile;
 
-  /* The ui_name is loaded from the ruleset. Until generalized actions
-   * are ready it has to be defined seperatly from other action data. */
+  /* Loaded from the ruleset. Until generalized actions are ready it has to
+   * be defined seperatly from other action data. */
   action->ui_name[0] = '\0';
+  action->quiet = FALSE;
 
   return action;
 }

Modified: branches/S2_6/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/actions.h?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/common/actions.h      (original)
+++ branches/S2_6/common/actions.h      Thu Mar 10 14:14:55 2016
@@ -137,6 +137,10 @@
 
   /* The name of the action shown in the UI */
   char ui_name[MAX_LEN_NAME];
+
+  /* Suppress automatic help text generation about what enables and/or
+   * disables this action. */
+  bool quiet;
 };
 
 struct action_enabler

Modified: branches/S2_6/common/packets.def
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/packets.def?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/common/packets.def    (original)
+++ branches/S2_6/common/packets.def    Thu Mar 10 14:14:55 2016
@@ -1664,6 +1664,7 @@
   GEN_ACTION id;
 
   STRING ui_name[MAX_LEN_NAME];
+  BOOL   quiet;
 end
 
 PACKET_RULESET_ACTION_ENABLER = 235; sc, lsend

Modified: branches/S2_6/data/alien/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/alien/game.ruleset?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/data/alien/game.ruleset       (original)
+++ branches/S2_6/data/alien/game.ruleset       Thu Mar 10 14:14:55 2016
@@ -225,6 +225,12 @@
 
 ; /* TRANS: Help _build Wonder (100% chance of success). */
 ui_name_help_wonder = _("Help %sbuild Wonder%s")
+
+; Suppress automatic help text generation about what enables and/or
+; disables the following actions.
+;
+; Can make the help text less redundant when you document it your self.
+;quiet_actions = "Targeted Sabotage City", "Targeted Steal Tech"
 
 ; /* <-- avoid gettext warnings
 ;

Modified: branches/S2_6/data/civ1/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/civ1/game.ruleset?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/data/civ1/game.ruleset        (original)
+++ branches/S2_6/data/civ1/game.ruleset        Thu Mar 10 14:14:55 2016
@@ -203,6 +203,12 @@
 
 ; /* TRANS: Help _build Wonder (100% chance of success). */
 ui_name_help_wonder = _("Help %sbuild Wonder%s")
+
+; Suppress automatic help text generation about what enables and/or
+; disables the following actions.
+;
+; Can make the help text less redundant when you document it your self.
+;quiet_actions = "Targeted Sabotage City", "Targeted Steal Tech"
 
 ; /* <-- avoid gettext warnings
 ;

Modified: branches/S2_6/data/civ2/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/civ2/game.ruleset?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/data/civ2/game.ruleset        (original)
+++ branches/S2_6/data/civ2/game.ruleset        Thu Mar 10 14:14:55 2016
@@ -228,6 +228,12 @@
 
 ; /* TRANS: Help _build Wonder (100% chance of success). */
 ui_name_help_wonder = _("Help %sbuild Wonder%s")
+
+; Suppress automatic help text generation about what enables and/or
+; disables the following actions.
+;
+; Can make the help text less redundant when you document it your self.
+;quiet_actions = "Targeted Sabotage City", "Targeted Steal Tech"
 
 ; /* <-- avoid gettext warnings
 ;

Modified: branches/S2_6/data/civ2civ3/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/civ2civ3/game.ruleset?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/data/civ2civ3/game.ruleset    (original)
+++ branches/S2_6/data/civ2civ3/game.ruleset    Thu Mar 10 14:14:55 2016
@@ -238,6 +238,12 @@
 
 ; /* TRANS: Help _build Wonder (100% chance of success). */
 ui_name_help_wonder = _("Help %sbuild Wonder%s")
+
+; Suppress automatic help text generation about what enables and/or
+; disables the following actions.
+;
+; Can make the help text less redundant when you document it your self.
+;quiet_actions = "Targeted Sabotage City", "Targeted Steal Tech"
 
 ; /* <-- avoid gettext warnings
 ;

Modified: branches/S2_6/data/classic/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/classic/game.ruleset?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/data/classic/game.ruleset     (original)
+++ branches/S2_6/data/classic/game.ruleset     Thu Mar 10 14:14:55 2016
@@ -230,6 +230,12 @@
 
 ; /* TRANS: Help _build Wonder (100% chance of success). */
 ui_name_help_wonder = _("Help %sbuild Wonder%s")
+
+; Suppress automatic help text generation about what enables and/or
+; disables the following actions.
+;
+; Can make the help text less redundant when you document it your self.
+;quiet_actions = "Targeted Sabotage City", "Targeted Steal Tech"
 
 ; /* <-- avoid gettext warnings
 ;

Modified: branches/S2_6/data/experimental/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/experimental/game.ruleset?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/data/experimental/game.ruleset        (original)
+++ branches/S2_6/data/experimental/game.ruleset        Thu Mar 10 14:14:55 2016
@@ -236,6 +236,12 @@
 
 ; /* TRANS: Help _build Wonder (100% chance of success). */
 ui_name_help_wonder = _("Help %sbuild Wonder%s")
+
+; Suppress automatic help text generation about what enables and/or
+; disables the following actions.
+;
+; Can make the help text less redundant when you document it your self.
+;quiet_actions = "Targeted Sabotage City", "Targeted Steal Tech"
 
 ; /* <-- avoid gettext warnings
 ;

Modified: branches/S2_6/data/multiplayer/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/multiplayer/game.ruleset?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/data/multiplayer/game.ruleset (original)
+++ branches/S2_6/data/multiplayer/game.ruleset Thu Mar 10 14:14:55 2016
@@ -228,6 +228,12 @@
 
 ; /* TRANS: Help _build Wonder (100% chance of success). */
 ui_name_help_wonder = _("Help %sbuild Wonder%s")
+
+; Suppress automatic help text generation about what enables and/or
+; disables the following actions.
+;
+; Can make the help text less redundant when you document it your self.
+;quiet_actions = "Targeted Sabotage City", "Targeted Steal Tech"
 
 ; /* <-- avoid gettext warnings
 ;

Modified: branches/S2_6/data/sandbox/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/sandbox/game.ruleset?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/data/sandbox/game.ruleset     (original)
+++ branches/S2_6/data/sandbox/game.ruleset     Thu Mar 10 14:14:55 2016
@@ -236,6 +236,12 @@
 
 ; /* TRANS: Help _build Wonder (100% chance of success). */
 ui_name_help_wonder = _("Help %sbuild Wonder%s")
+
+; Suppress automatic help text generation about what enables and/or
+; disables the following actions.
+;
+; Can make the help text less redundant when you document it your self.
+;quiet_actions = "Targeted Sabotage City", "Targeted Steal Tech"
 
 ; /* <-- avoid gettext warnings
 ;

Modified: branches/S2_6/data/stub/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/stub/game.ruleset?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/data/stub/game.ruleset        (original)
+++ branches/S2_6/data/stub/game.ruleset        Thu Mar 10 14:14:55 2016
@@ -203,6 +203,12 @@
 ;
 ; */ <-- avoid gettext warnings
 
+; Suppress automatic help text generation about what enables and/or
+; disables the following actions.
+;
+; Can make the help text less redundant when you document it your self.
+;quiet_actions = "Targeted Sabotage City", "Targeted Steal Tech"
+
 ; No enabled actions
 ; [actionenabler_embassy]
 ; action = "Establish Embassy"

Modified: branches/S2_6/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/fc_version?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/fc_version    (original)
+++ branches/S2_6/fc_version    Thu Mar 10 14:14:55 2016
@@ -55,7 +55,7 @@
 #   - Avoid adding a new mandatory capability to the development branch for
 #     as long as possible.  We want to maintain network compatibility with
 #     the stable branch for as long as possible.
-NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-2.6-2016.Mar.08"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-2.6-2016.Mar.10"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: branches/S2_6/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/ruleset.c?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/server/ruleset.c      (original)
+++ branches/S2_6/server/ruleset.c      Thu Mar 10 14:14:55 2016
@@ -5456,6 +5456,35 @@
           "actions.ui_name_help_wonder");
       sz_strlcpy(action_by_number(ACTION_HELP_WONDER)->ui_name,
                  text);
+
+      /* The quiet (don't auto generate help for) property of all actions
+       * live in a single enum vector. This avoids generic action
+       * expectations. */
+      if (secfile_entry_by_path(file, "actions.quiet_actions")) {
+        enum gen_action *quiet_actions;
+        size_t asize;
+        int j;
+
+        quiet_actions =
+            secfile_lookup_enum_vec(file, &asize, gen_action,
+                                    "actions.quiet_actions");
+
+        if (!quiet_actions) {
+          /* Entity exists but couldn't read it. */
+          ruleset_error(LOG_ERROR,
+                        "\"%s\": actions.quiet_actions: bad action list",
+                        filename);
+
+          ok = FALSE;
+        }
+
+        for (j = 0; j < asize; j++) {
+          /* Don't auto generate help text for this action. */
+          action_by_number(quiet_actions[j])->quiet = TRUE;
+        }
+
+        free(quiet_actions);
+      }
     }
 
     if (ok) {
@@ -6455,6 +6484,7 @@
   action_iterate(act) {
     packet.id = act;
     sz_strlcpy(packet.ui_name, action_by_number(act)->ui_name);
+    packet.quiet = action_by_number(act)->quiet;
 
     lsend_packet_ruleset_action(dest, &packet);
   } action_iterate_end;

Modified: branches/S2_6/tools/ruledit/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/tools/ruledit/rulesave.c?rev=32222&r1=32221&r2=32222&view=diff
==============================================================================
--- branches/S2_6/tools/ruledit/rulesave.c      (original)
+++ branches/S2_6/tools/ruledit/rulesave.c      Thu Mar 10 14:14:55 2016
@@ -640,6 +640,7 @@
                                 * safety margin here. */
   enum trade_route_type trt;
   int i;
+  enum gen_action quiet_actions[ACTION_COUNT];
   bool locks;
 
   if (sfile == NULL) {
@@ -862,6 +863,21 @@
                      action_by_number(ACTION_HELP_WONDER)->ui_name,
                      "actions.ui_name_help_wonder");
 
+  i = 0;
+  action_iterate(act) {
+    if (action_by_number(act)->quiet) {
+      quiet_actions[i] = act;
+      i++;
+    }
+  } action_iterate_end;
+
+  if (secfile_insert_enum_vec(sfile, &quiet_actions, i, gen_action,
+                              "actions.quiet_actions") != i) {
+    log_error("Didn't save all quiet actions.");
+
+    return FALSE;
+  }
+
   sect_idx = 0;
   action_enablers_iterate(pae) {
     char path[512];


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

Reply via email to