Author: cazfi
Date: Wed Dec  9 22:17:11 2015
New Revision: 30925

URL: http://svn.gna.org/viewcvs/freeciv?rev=30925&view=rev
Log:
Rename the new implementation of lua API function give_technology() as 
give_tech()
and restore give_technology() implementation compatible with old versions to 
support
scenarios in older savegame formats.

See patch #6631

Modified:
    branches/S2_6/data/alien/script.lua
    branches/S2_6/data/default/default.lua
    branches/S2_6/data/multiplayer/script.lua
    branches/S2_6/server/scripting/tolua_server.pkg

Modified: branches/S2_6/data/alien/script.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/alien/script.lua?rev=30925&r1=30924&r2=30925&view=diff
==============================================================================
--- branches/S2_6/data/alien/script.lua (original)
+++ branches/S2_6/data/alien/script.lua Wed Dec  9 22:17:11 2015
@@ -24,7 +24,7 @@
 -- Get a tech from entering a hut.
 function alien_hut_get_tech(unit)
   local owner = unit.owner
-  local tech = owner:give_technology(nil, -1, "hut")
+  local tech = owner:give_tech(nil, -1, "hut")
 
   if tech then
     notify.event(owner, unit.tile, E.HUT_TECH,

Modified: branches/S2_6/data/default/default.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/default/default.lua?rev=30925&r1=30924&r2=30925&view=diff
==============================================================================
--- branches/S2_6/data/default/default.lua      (original)
+++ branches/S2_6/data/default/default.lua      Wed Dec  9 22:17:11 2015
@@ -33,7 +33,7 @@
 -- Get a tech from entering a hut.
 function default_hut_get_tech(unit)
   local owner = unit.owner
-  local tech = owner:give_technology(nil, -1, "hut")
+  local tech = owner:give_tech(nil, -1, "hut")
 
   if tech then
     notify.event(owner, unit.tile, E.HUT_TECH,

Modified: branches/S2_6/data/multiplayer/script.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/multiplayer/script.lua?rev=30925&r1=30924&r2=30925&view=diff
==============================================================================
--- branches/S2_6/data/multiplayer/script.lua   (original)
+++ branches/S2_6/data/multiplayer/script.lua   Wed Dec  9 22:17:11 2015
@@ -31,11 +31,11 @@
     -- getting two free advances again.
     -- This also prevents those they share research with from getting two
     -- free advances from building Darwin`s Voyage themselves.
-    if player:give_technology(find.tech_type("Theory of Evolution"),
-                              0, "researched") then
+    if player:give_tech(find.tech_type("Theory of Evolution"),
+                        0, "researched") then
       -- Give the player two free advances.
-      gained[0] = player:give_technology(nil, 0, "researched")
-      gained[1] = player:give_technology(nil, 0, "researched")
+      gained[0] = player:give_tech(nil, 0, "researched")
+      gained[1] = player:give_tech(nil, 0, "researched")
 
       -- Notify the player. Include the tech names in a way that makes it
       -- look natural no matter if each tech is announced or not.
@@ -112,7 +112,7 @@
 
     -- Give the player a free advance.
     -- This will give a free advance for each player that shares research.
-    gained = player:give_technology(nil, -1, "researched")
+    gained = player:give_tech(nil, -1, "researched")
 
       -- Notify the player. Include the tech names in a way that makes it
       -- look natural no matter if each tech is announced or not.

Modified: branches/S2_6/server/scripting/tolua_server.pkg
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/scripting/tolua_server.pkg?rev=30925&r1=30924&r2=30925&view=diff
==============================================================================
--- branches/S2_6/server/scripting/tolua_server.pkg     (original)
+++ branches/S2_6/server/scripting/tolua_server.pkg     Wed Dec  9 22:17:11 2015
@@ -141,8 +141,8 @@
    *    -2          - Apply conquercost
    *    -3          - Apply diplbulbcost */
   Tech_Type *api_edit_give_technology
-    @ give_technology (lua_State *L, Player *pplayer, Tech_Type *ptech,
-                       int cost, const char *reason);
+    @ give_tech (lua_State *L, Player *pplayer, Tech_Type *ptech,
+                 int cost, const char *reason);
   bool api_edit_trait_mod_set
     @ trait_mod (lua_State *L, Player *pplayer, const char *trait_name,
                  const int mod);
@@ -204,8 +204,14 @@
   edit.change_gold(pplayer, amount)
 end
 
-function give_technology(player, tech, cost, reason)
-  return edit.give_technology(player, tech, cost, reason)
+-- Deprecated; use edit.give_tech()
+function give_technology(player, tech, reason)
+  return edit.give_tech(player, tech, -1, reason)
+end
+
+-- Deprecated; use edit.give_tech()
+function edit.give_technology(player, tech, reason)
+  return edit.give_tech(player, tech, -1, reason)
 end
 
 function trait_mod(player, trait, mod)
@@ -244,8 +250,13 @@
   edit.change_gold(self, amount)
 end
 
-function Player:give_technology(tech, cost, reason)
-  return edit.give_technology(self, tech, cost, reason)
+function Player:give_tech(tech, cost, reason)
+  return edit.give_tech(self, tech, cost, reason)
+end
+
+-- Deprecated; use Player:give_tech()
+function Player:give_technology(tech, reason)
+  return edit.give_tech(self, tech, -1, reason)
 end
 
 function Player:trait_mod(trait, mod)


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

Reply via email to