Author: sveinung
Date: Thu Mar 10 14:03:54 2016
New Revision: 32220

URL: http://svn.gna.org/viewcvs/freeciv?rev=32220&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:
    trunk/client/helpdata.c
    trunk/client/packhand.c
    trunk/common/actions.c
    trunk/common/actions.h
    trunk/common/packets.def
    trunk/data/alien/game.ruleset
    trunk/data/civ1/game.ruleset
    trunk/data/civ2/game.ruleset
    trunk/data/civ2civ3/game.ruleset
    trunk/data/classic/game.ruleset
    trunk/data/experimental/game.ruleset
    trunk/data/multiplayer/game.ruleset
    trunk/data/sandbox/game.ruleset
    trunk/data/stub/game.ruleset
    trunk/fc_version
    trunk/server/ruleset.c
    trunk/tools/ruledit/rulesave.c

Modified: trunk/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/client/helpdata.c     (original)
+++ trunk/client/helpdata.c     Thu Mar 10 14:03:54 2016
@@ -4310,6 +4310,11 @@
     }
   }
   action_iterate(act) {
+    if (action_by_number(act)->quiet) {
+      /* The ruleset documents this action it self. */
+      continue;
+    }
+
     if (utype_can_do_action(utype, act)) {
       switch (act) {
       case ACTION_HELP_WONDER:
@@ -4411,6 +4416,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
@@ -5767,6 +5777,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: trunk/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/client/packhand.c     (original)
+++ trunk/client/packhand.c     Thu Mar 10 14:03:54 2016
@@ -3854,6 +3854,7 @@
   act = action_by_number(p->id);
 
   sz_strlcpy(act->ui_name, p->ui_name);
+  act->quiet = p->quiet;
 }
 
 /****************************************************************************

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Thu Mar 10 14:03:54 2016
@@ -309,9 +309,10 @@
   action->min_distance = min_distance;
   action->max_distance = max_distance;
 
-  /* 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: trunk/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.h?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/common/actions.h      (original)
+++ trunk/common/actions.h      Thu Mar 10 14:03:54 2016
@@ -203,6 +203,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: trunk/common/packets.def
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/packets.def?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/common/packets.def    (original)
+++ trunk/common/packets.def    Thu Mar 10 14:03:54 2016
@@ -1685,6 +1685,7 @@
   GEN_ACTION id;
 
   STRING ui_name[MAX_LEN_NAME];
+  BOOL   quiet;
 end
 
 PACKET_RULESET_ACTION_ENABLER = 235; sc, lsend

Modified: trunk/data/alien/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/game.ruleset?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/data/alien/game.ruleset       (original)
+++ trunk/data/alien/game.ruleset       Thu Mar 10 14:03:54 2016
@@ -271,6 +271,12 @@
 
 ; /* TRANS: _Airlift to City (100% chance of success). */
 ui_airlift_unit = _("%sAirlift to City%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: trunk/data/civ1/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/game.ruleset?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/data/civ1/game.ruleset        (original)
+++ trunk/data/civ1/game.ruleset        Thu Mar 10 14:03:54 2016
@@ -243,6 +243,12 @@
 
 ; /* TRANS: _Airlift to City (100% chance of success). */
 ui_airlift_unit = _("%sAirlift to City%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: trunk/data/civ2/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/game.ruleset?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/data/civ2/game.ruleset        (original)
+++ trunk/data/civ2/game.ruleset        Thu Mar 10 14:03:54 2016
@@ -275,6 +275,12 @@
 
 ; /* TRANS: _Airlift to City (100% chance of success). */
 ui_airlift_unit = _("%sAirlift to City%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: trunk/data/civ2civ3/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/game.ruleset?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/data/civ2civ3/game.ruleset    (original)
+++ trunk/data/civ2civ3/game.ruleset    Thu Mar 10 14:03:54 2016
@@ -287,6 +287,12 @@
 
 ; /* TRANS: _Airlift to City (100% chance of success). */
 ui_airlift_unit = _("%sAirlift to City%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: trunk/data/classic/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/game.ruleset?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/data/classic/game.ruleset     (original)
+++ trunk/data/classic/game.ruleset     Thu Mar 10 14:03:54 2016
@@ -274,6 +274,12 @@
 
 ; /* TRANS: _Airlift to City (100% chance of success). */
 ui_airlift_unit = _("%sAirlift to City%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: trunk/data/experimental/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/game.ruleset?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/data/experimental/game.ruleset        (original)
+++ trunk/data/experimental/game.ruleset        Thu Mar 10 14:03:54 2016
@@ -279,6 +279,12 @@
 
 ; /* TRANS: _Airlift to City (100% chance of success). */
 ui_airlift_unit = _("%sAirlift to City%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: trunk/data/multiplayer/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/game.ruleset?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/data/multiplayer/game.ruleset (original)
+++ trunk/data/multiplayer/game.ruleset Thu Mar 10 14:03:54 2016
@@ -271,6 +271,12 @@
 
 ; /* TRANS: _Airlift to City (100% chance of success). */
 ui_airlift_unit = _("%sAirlift to City%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: trunk/data/sandbox/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/game.ruleset?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/data/sandbox/game.ruleset     (original)
+++ trunk/data/sandbox/game.ruleset     Thu Mar 10 14:03:54 2016
@@ -287,6 +287,12 @@
 
 ; /* TRANS: _Airlift to City (100% chance of success). */
 ui_airlift_unit = _("%sAirlift to City%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: trunk/data/stub/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/stub/game.ruleset?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/data/stub/game.ruleset        (original)
+++ trunk/data/stub/game.ruleset        Thu Mar 10 14:03:54 2016
@@ -219,6 +219,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: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Thu Mar 10 14:03:54 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-3.0-2016.Mar.06"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2016.Mar.10"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/server/ruleset.c      (original)
+++ trunk/server/ruleset.c      Thu Mar 10 14:03:54 2016
@@ -5874,6 +5874,35 @@
           "actions.ui_airlift_unit");
       sz_strlcpy(action_by_number(ACTION_AIRLIFT)->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) {
@@ -6979,6 +7008,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: trunk/tools/ruledit/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/rulesave.c?rev=32220&r1=32219&r2=32220&view=diff
==============================================================================
--- trunk/tools/ruledit/rulesave.c      (original)
+++ trunk/tools/ruledit/rulesave.c      Thu Mar 10 14:03:54 2016
@@ -731,6 +731,7 @@
                                 * safety margin here. */
   enum trade_route_type trt;
   int i;
+  enum gen_action quiet_actions[ACTION_COUNT];
   bool locks;
 
   if (sfile == NULL) {
@@ -1007,6 +1008,21 @@
                      action_by_number(ACTION_AIRLIFT)->ui_name,
                      "actions.ui_airlift_unit");
 
+  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