Author: cazfi
Date: Sat Dec 12 19:31:06 2015
New Revision: 30962

URL: http://svn.gna.org/viewcvs/freeciv?rev=30962&view=rev
Log:
Added lua scripts access to research names.

See patch #6603

Modified:
    branches/S2_6/common/scriptcore/api_game_methods.c
    branches/S2_6/common/scriptcore/api_game_methods.h
    branches/S2_6/common/scriptcore/tolua_game.pkg
    branches/S2_6/data/alien/script.lua
    branches/S2_6/data/default/default.lua
    branches/S2_6/data/multiplayer/script.lua

Modified: branches/S2_6/common/scriptcore/api_game_methods.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/scriptcore/api_game_methods.c?rev=30962&r1=30961&r2=30962&view=diff
==============================================================================
--- branches/S2_6/common/scriptcore/api_game_methods.c  (original)
+++ branches/S2_6/common/scriptcore/api_game_methods.c  Sat Dec 12 19:31:06 2015
@@ -379,6 +379,28 @@
 }
 
 /*****************************************************************************
+  Return name of the research group player belongs to.
+*****************************************************************************/
+const char *api_methods_research_rule_name(lua_State *L, Player *pplayer)
+{
+  LUASCRIPT_CHECK_STATE(L, FALSE);
+  LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
+
+  return research_rule_name(research_get(pplayer));
+}
+
+/*****************************************************************************
+  Return name of the research group player belongs to.
+*****************************************************************************/
+const char *api_methods_research_name_translation(lua_State *L, Player 
*pplayer)
+{
+  LUASCRIPT_CHECK_STATE(L, FALSE);
+  LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
+
+  return research_name_translation(research_get(pplayer));
+}
+
+/*****************************************************************************
   Return list head for unit list for Player
 *****************************************************************************/
 Unit_List_Link *api_methods_private_player_unit_list_head(lua_State *L,

Modified: branches/S2_6/common/scriptcore/api_game_methods.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/scriptcore/api_game_methods.h?rev=30962&r1=30961&r2=30962&view=diff
==============================================================================
--- branches/S2_6/common/scriptcore/api_game_methods.h  (original)
+++ branches/S2_6/common/scriptcore/api_game_methods.h  Sat Dec 12 19:31:06 2015
@@ -77,6 +77,8 @@
                                    Tech_Type *ptech);
 bool api_methods_player_shares_research(lua_State *L, Player *pplayer,
                                         Player *aplayer);
+const char *api_methods_research_rule_name(lua_State *L, Player *pplayer);
+const char *api_methods_research_name_translation(lua_State *L, Player 
*pplayer);
 Unit_List_Link *api_methods_private_player_unit_list_head(lua_State *L,
                                                           Player *pplayer);
 City_List_Link *api_methods_private_player_city_list_head(lua_State *L,

Modified: branches/S2_6/common/scriptcore/tolua_game.pkg
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/scriptcore/tolua_game.pkg?rev=30962&r1=30961&r2=30962&view=diff
==============================================================================
--- branches/S2_6/common/scriptcore/tolua_game.pkg      (original)
+++ branches/S2_6/common/scriptcore/tolua_game.pkg      Sat Dec 12 19:31:06 2015
@@ -136,6 +136,10 @@
     @ knows_tech (lua_State *L, Player *self, Tech_Type *ptech);
   bool api_methods_player_shares_research
     @ shares_research (lua_State *L, Player *self, Player *other);
+  const char *api_methods_research_rule_name
+    @ research_rule_name (lua_State *L, Player *self);
+  const char *api_methods_research_name_translation
+    @ research_name_translation (lua_State *L, Player *self);
 
   int api_methods_player_culture_get
     @ culture(lua_State *L, Player *self);

Modified: branches/S2_6/data/alien/script.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/alien/script.lua?rev=30962&r1=30961&r2=30962&view=diff
==============================================================================
--- branches/S2_6/data/alien/script.lua (original)
+++ branches/S2_6/data/alien/script.lua Sat Dec 12 19:31:06 2015
@@ -36,7 +36,7 @@
                  tech:name_translation())
     notify.research_embassies(owner, E.HUT_TECH,
                  _("The %s have acquired %s from Space Capsule they found."),
-                 owner.nation:plural_translation(),
+                 owner:research_name_translation(),
                  tech:name_translation())
     return true
   else

Modified: branches/S2_6/data/default/default.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/default/default.lua?rev=30962&r1=30961&r2=30962&view=diff
==============================================================================
--- branches/S2_6/data/default/default.lua      (original)
+++ branches/S2_6/data/default/default.lua      Sat Dec 12 19:31:06 2015
@@ -46,7 +46,7 @@
                  tech:name_translation())
     notify.research_embassies(owner, E.TECH_EMBASSY,
                  _("The %s have acquired %s from ancient scrolls of wisdom."),
-                 owner.nation:plural_translation(),
+                 owner:research_name_translation(),
                  tech:name_translation())
     return true
   else

Modified: branches/S2_6/data/multiplayer/script.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/multiplayer/script.lua?rev=30962&r1=30961&r2=30962&view=diff
==============================================================================
--- branches/S2_6/data/multiplayer/script.lua   (original)
+++ branches/S2_6/data/multiplayer/script.lua   Sat Dec 12 19:31:06 2015
@@ -56,7 +56,7 @@
       -- They should therefore be informed about the source here too.
       notify.research_embassies(player, E.TECH_EMBASSY,
                                 _("The %s gain %s and %s from %s."),
-                                player.nation:plural_translation(),
+                                player:research_name_translation(),
                                 gained[0]:name_translation(),
                                 gained[1]:name_translation(),
                                 darw_btype:name_translation())
@@ -130,7 +130,7 @@
     -- They should therefore be informed about the source here too.
     notify.research_embassies(player, E.TECH_EMBASSY,
             _("Great philosophers from all the world join the %s: they get %s 
as an immediate advance."),
-            player.nation:plural_translation(),
+            player:research_name_translation(),
             gained:name_translation())
   end
 end 


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

Reply via email to