Author: cazfi
Date: Wed Dec 16 21:10:20 2015
New Revision: 31026

URL: http://svn.gna.org/viewcvs/freeciv?rev=31026&view=rev
Log:
Tech bonus message turned to a format string containing space for the name of 
the tech gained.

See patch #6553

Modified:
    branches/S2_6/data/alien/techs.ruleset
    branches/S2_6/data/civ1/techs.ruleset
    branches/S2_6/data/civ2/techs.ruleset
    branches/S2_6/data/civ2civ3/techs.ruleset
    branches/S2_6/data/classic/techs.ruleset
    branches/S2_6/data/experimental/techs.ruleset
    branches/S2_6/data/multiplayer/techs.ruleset
    branches/S2_6/data/sandbox/techs.ruleset
    branches/S2_6/data/stub/techs.ruleset
    branches/S2_6/server/rssanity.c
    branches/S2_6/server/techtools.c

Modified: branches/S2_6/data/alien/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/alien/techs.ruleset?rev=31026&r1=31025&r2=31026&view=diff
==============================================================================
--- branches/S2_6/data/alien/techs.ruleset      (original)
+++ branches/S2_6/data/alien/techs.ruleset      Wed Dec 16 21:10:20 2015
@@ -38,8 +38,9 @@
 ; graphic       = icon for technology
 ; graphic_alt   = alternate icon
 ; helptext     = optional help text string (set units ruleset for examples)
-; bonus_message = text seen when a player is the first to 
-;                 discover an bonus tech.
+; bonus_message = text seen when a player is the first to discover
+;                 an bonus tech. Must contain '%s' to mark place of the tech
+;                 gained.
 ; cost          = if tech_cost_style is set to "Classic+" or "Experimental+",
 ;                 this field is read for information on how much a tech
 ;                 costs.

Modified: branches/S2_6/data/civ1/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/civ1/techs.ruleset?rev=31026&r1=31025&r2=31026&view=diff
==============================================================================
--- branches/S2_6/data/civ1/techs.ruleset       (original)
+++ branches/S2_6/data/civ1/techs.ruleset       Wed Dec 16 21:10:20 2015
@@ -44,8 +44,9 @@
 ; graphic       = icon for technology
 ; graphic_alt   = alternate icon
 ; helptext     = optional help text string (set units ruleset for examples)
-; bonus_message = text seen when a player is the first to 
-;                 discover an bonus tech.
+; bonus_message = text seen when a player is the first to discover
+;                 an bonus tech. Must contain '%s' to mark place of the tech
+;                 gained.
 ; cost          = if tech_cost_style is set to "Classic+" or "Experimental+",
 ;                 this field is read for information on how much a tech
 ;                 costs.

Modified: branches/S2_6/data/civ2/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/civ2/techs.ruleset?rev=31026&r1=31025&r2=31026&view=diff
==============================================================================
--- branches/S2_6/data/civ2/techs.ruleset       (original)
+++ branches/S2_6/data/civ2/techs.ruleset       Wed Dec 16 21:10:20 2015
@@ -44,8 +44,9 @@
 ; graphic       = icon for technology
 ; graphic_alt   = alternate icon
 ; helptext     = optional help text string (set units ruleset for examples)
-; bonus_message = text seen when a player is the first to 
-;                 discover an bonus tech.
+; bonus_message = text seen when a player is the first to discover
+;                 an bonus tech. Must contain '%s' to mark place of the tech
+;                 gained.
 ; cost          = if tech_cost_style is set to "Classic+" or "Experimental+",
 ;                 this field is read for information on how much a tech
 ;                 costs.
@@ -541,7 +542,7 @@
 req2     = "Literacy"
 flags    = "Bonus_Tech"
 bonus_message = _("Great philosophers from all the world join \
-your civilization: you get an immediate advance.")
+your civilization: you learn %s immediately.")
 graphic     = "a.philosophy"
 graphic_alt = "-"
 

Modified: branches/S2_6/data/civ2civ3/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/civ2civ3/techs.ruleset?rev=31026&r1=31025&r2=31026&view=diff
==============================================================================
--- branches/S2_6/data/civ2civ3/techs.ruleset   (original)
+++ branches/S2_6/data/civ2civ3/techs.ruleset   Wed Dec 16 21:10:20 2015
@@ -45,8 +45,9 @@
 ; graphic       = icon for technology
 ; graphic_alt   = alternate icon
 ; helptext     = optional help text string (set units ruleset for examples)
-; bonus_message = text seen when a player is the first to 
-;                 discover an bonus tech.
+; bonus_message = text seen when a player is the first to discover
+;                 an bonus tech. Must contain '%s' to mark place of the tech
+;                 gained.
 ; cost          = if tech_cost_style is set to "Classic+" or "Experimental+",
 ;                 this field is read for information on how much a tech
 ;                 costs.
@@ -616,7 +617,7 @@
 req2     = "Literacy"
 flags    = "Bonus_Tech"
 bonus_message = _("Great philosophers from all the world join \
-your civilization: you get an immediate advance.")
+your civilization: you learn %s immediately.")
 graphic     = "a.philosophy"
 graphic_alt = "-"
 cost     = 70

Modified: branches/S2_6/data/classic/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/classic/techs.ruleset?rev=31026&r1=31025&r2=31026&view=diff
==============================================================================
--- branches/S2_6/data/classic/techs.ruleset    (original)
+++ branches/S2_6/data/classic/techs.ruleset    Wed Dec 16 21:10:20 2015
@@ -45,8 +45,9 @@
 ; graphic       = icon for technology
 ; graphic_alt   = alternate icon
 ; helptext     = optional help text string (set units ruleset for examples)
-; bonus_message = text seen when a player is the first to 
-;                 discover an bonus tech.
+; bonus_message = text seen when a player is the first to discover
+;                 an bonus tech. Must contain '%s' to mark place of the tech
+;                 gained.
 ; cost          = if tech_cost_style is set to "Classic+" or "Experimental+",
 ;                 this field is read for information on how much a tech
 ;                 costs.
@@ -548,7 +549,7 @@
 req2     = "Literacy"
 flags    = "Bonus_Tech"
 bonus_message = _("Great philosophers from all the world join \
-your civilization: you get an immediate advance.")
+your civilization: you learn %s immediately.")
 graphic     = "a.philosophy"
 graphic_alt = "-"
 

Modified: branches/S2_6/data/experimental/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/experimental/techs.ruleset?rev=31026&r1=31025&r2=31026&view=diff
==============================================================================
--- branches/S2_6/data/experimental/techs.ruleset       (original)
+++ branches/S2_6/data/experimental/techs.ruleset       Wed Dec 16 21:10:20 2015
@@ -47,8 +47,9 @@
 ; graphic       = icon for technology
 ; graphic_alt   = alternate icon
 ; helptext     = optional help text string (set units ruleset for examples)
-; bonus_message = text seen when a player is the first to 
-;                 discover an bonus tech.
+; bonus_message = text seen when a player is the first to discover
+;                 an bonus tech. Must contain '%s' to mark place of the tech
+;                 gained.
 ; cost          = if tech_cost_style is set to "Classic+" or "Experimental+",
 ;                 this field is read for information on how much a tech
 ;                 costs.
@@ -603,7 +604,7 @@
 root_req = "Literacy"
 flags    = "Bonus_Tech"
 bonus_message = _("Great philosophers from all the world join \
-your civilization: you get an immediate advance.")
+your civilization: you learn %s immediately.")
 graphic     = "a.philosophy"
 graphic_alt = "-"
 

Modified: branches/S2_6/data/multiplayer/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/multiplayer/techs.ruleset?rev=31026&r1=31025&r2=31026&view=diff
==============================================================================
--- branches/S2_6/data/multiplayer/techs.ruleset        (original)
+++ branches/S2_6/data/multiplayer/techs.ruleset        Wed Dec 16 21:10:20 2015
@@ -45,8 +45,9 @@
 ; graphic       = icon for technology
 ; graphic_alt   = alternate icon
 ; helptext     = optional help text string (set units ruleset for examples)
-; bonus_message = text seen when a player is the first to 
-;                 discover an bonus tech.
+; bonus_message = text seen when a player is the first to discover
+;                 an bonus tech. Must contain '%s' to mark place of the tech
+;                 gained.
 ; cost          = if tech_cost_style is set to "Classic+" or "Experimental+",
 ;                 this field is read for information on how much a tech
 ;                 costs.

Modified: branches/S2_6/data/sandbox/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/sandbox/techs.ruleset?rev=31026&r1=31025&r2=31026&view=diff
==============================================================================
--- branches/S2_6/data/sandbox/techs.ruleset    (original)
+++ branches/S2_6/data/sandbox/techs.ruleset    Wed Dec 16 21:10:20 2015
@@ -45,8 +45,9 @@
 ; graphic       = icon for technology
 ; graphic_alt   = alternate icon
 ; helptext     = optional help text string (set units ruleset for examples)
-; bonus_message = text seen when a player is the first to 
-;                 discover an bonus tech.
+; bonus_message = text seen when a player is the first to discover
+;                 an bonus tech. Must contain '%s' to mark place of the tech
+;                 gained.
 ; cost          = if tech_cost_style is set to "Classic+" or "Experimental+",
 ;                 this field is read for information on how much a tech
 ;                 costs.
@@ -616,7 +617,7 @@
 req2     = "Literacy"
 flags    = "Bonus_Tech"
 bonus_message = _("Great philosophers from all the world join \
-your civilization: you get an immediate advance.")
+your civilization: you learn %s immediately.")
 graphic     = "a.philosophy"
 graphic_alt = "-"
 cost     = 70

Modified: branches/S2_6/data/stub/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/stub/techs.ruleset?rev=31026&r1=31025&r2=31026&view=diff
==============================================================================
--- branches/S2_6/data/stub/techs.ruleset       (original)
+++ branches/S2_6/data/stub/techs.ruleset       Wed Dec 16 21:10:20 2015
@@ -35,8 +35,9 @@
 ; graphic       = icon for technology
 ; graphic_alt   = alternate icon
 ; helptext     = optional help text string (set units ruleset for examples)
-; bonus_message = text seen when a player is the first to 
-;                 discover an bonus tech.
+; bonus_message = text seen when a player is the first to discover
+;                 an bonus tech. Must contain '%s' to mark place of the tech
+;                 gained.
 ; cost          = if tech_cost_style is set to "Classic+" or "Experimental+",
 ;                 this field is read for information on how much a tech
 ;                 costs.

Modified: branches/S2_6/server/rssanity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/rssanity.c?rev=31026&r1=31025&r2=31026&view=diff
==============================================================================
--- branches/S2_6/server/rssanity.c     (original)
+++ branches/S2_6/server/rssanity.c     Wed Dec 16 21:10:20 2015
@@ -585,6 +585,15 @@
         }
       } advance_req_iterate_end;
     }
+
+    if (padvance->bonus_message != NULL) {
+      if (!formats_match(padvance->bonus_message, "%s")) {
+        ruleset_error(LOG_ERROR,
+                      "Tech \"%s\" bonus message is not format with %%s for a 
bonus tech name.",
+                      advance_rule_name(padvance));
+        ok = FALSE;
+      }
+    }
   } advance_iterate_end;
 
   /* Check that all players can have their initial techs */

Modified: branches/S2_6/server/techtools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/techtools.c?rev=31026&r1=31025&r2=31026&view=diff
==============================================================================
--- branches/S2_6/server/techtools.c    (original)
+++ branches/S2_6/server/techtools.c    Wed Dec 16 21:10:20 2015
@@ -531,14 +531,11 @@
 
     radv_name = research_advance_name_translation(presearch, additional_tech);
 
-    if (advance_by_number(tech_found)->bonus_message) {
+    if (advance_by_number(tech_found)->bonus_message != NULL
+        && additional_tech != A_UNSET) {
       notify_research(presearch, NULL, E_TECH_GAIN, ftc_server,
-                      "%s", _(advance_by_number(tech_found)->bonus_message));
-      if (additional_tech != A_UNSET) {
-        notify_research(presearch, NULL, E_TECH_GAIN, ftc_server,
-                        /* TRANS: Got free tech. */
-                        _("Acquired %s."), radv_name);
-      }
+                      _(advance_by_number(tech_found)->bonus_message),
+                      radv_name);
     } else if (additional_tech != A_UNSET) {
       /* FIXME: "your" when it was just civilization of one of the players
        * sharing the reseach. */


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

Reply via email to