Author: cazfi
Date: Wed Dec 16 21:10:15 2015
New Revision: 31025

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

See patch #6553

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

Modified: trunk/data/alien/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/techs.ruleset?rev=31025&r1=31024&r2=31025&view=diff
==============================================================================
--- trunk/data/alien/techs.ruleset      (original)
+++ trunk/data/alien/techs.ruleset      Wed Dec 16 21:10:15 2015
@@ -48,8 +48,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: trunk/data/civ1/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/techs.ruleset?rev=31025&r1=31024&r2=31025&view=diff
==============================================================================
--- trunk/data/civ1/techs.ruleset       (original)
+++ trunk/data/civ1/techs.ruleset       Wed Dec 16 21:10:15 2015
@@ -54,8 +54,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: trunk/data/civ2/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/techs.ruleset?rev=31025&r1=31024&r2=31025&view=diff
==============================================================================
--- trunk/data/civ2/techs.ruleset       (original)
+++ trunk/data/civ2/techs.ruleset       Wed Dec 16 21:10:15 2015
@@ -54,8 +54,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.
@@ -551,7 +552,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: trunk/data/civ2civ3/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/techs.ruleset?rev=31025&r1=31024&r2=31025&view=diff
==============================================================================
--- trunk/data/civ2civ3/techs.ruleset   (original)
+++ trunk/data/civ2civ3/techs.ruleset   Wed Dec 16 21:10:15 2015
@@ -55,8 +55,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.
@@ -626,7 +627,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: trunk/data/classic/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/techs.ruleset?rev=31025&r1=31024&r2=31025&view=diff
==============================================================================
--- trunk/data/classic/techs.ruleset    (original)
+++ trunk/data/classic/techs.ruleset    Wed Dec 16 21:10:15 2015
@@ -55,8 +55,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.
@@ -558,7 +559,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: trunk/data/experimental/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/techs.ruleset?rev=31025&r1=31024&r2=31025&view=diff
==============================================================================
--- trunk/data/experimental/techs.ruleset       (original)
+++ trunk/data/experimental/techs.ruleset       Wed Dec 16 21:10:15 2015
@@ -57,8 +57,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.
@@ -613,7 +614,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: trunk/data/multiplayer/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/techs.ruleset?rev=31025&r1=31024&r2=31025&view=diff
==============================================================================
--- trunk/data/multiplayer/techs.ruleset        (original)
+++ trunk/data/multiplayer/techs.ruleset        Wed Dec 16 21:10:15 2015
@@ -55,8 +55,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: trunk/data/sandbox/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/techs.ruleset?rev=31025&r1=31024&r2=31025&view=diff
==============================================================================
--- trunk/data/sandbox/techs.ruleset    (original)
+++ trunk/data/sandbox/techs.ruleset    Wed Dec 16 21:10:15 2015
@@ -55,8 +55,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.
@@ -626,7 +627,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: trunk/data/stub/techs.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/stub/techs.ruleset?rev=31025&r1=31024&r2=31025&view=diff
==============================================================================
--- trunk/data/stub/techs.ruleset       (original)
+++ trunk/data/stub/techs.ruleset       Wed Dec 16 21:10:15 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: trunk/server/rssanity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rssanity.c?rev=31025&r1=31024&r2=31025&view=diff
==============================================================================
--- trunk/server/rssanity.c     (original)
+++ trunk/server/rssanity.c     Wed Dec 16 21:10:15 2015
@@ -631,6 +631,15 @@
         ok = FALSE;
       }
     } requirement_vector_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: trunk/server/techtools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/techtools.c?rev=31025&r1=31024&r2=31025&view=diff
==============================================================================
--- trunk/server/techtools.c    (original)
+++ trunk/server/techtools.c    Wed Dec 16 21:10:15 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