Author: jtn
Date: Mon Nov 17 11:28:54 2014
New Revision: 27059

URL: http://svn.gna.org/viewcvs/freeciv?rev=27059&view=rev
Log:
Add new Lua function (Player):shares_research(Player).

See gna patch #5408.

Modified:
    trunk/common/scriptcore/api_game_methods.c
    trunk/common/scriptcore/api_game_methods.h
    trunk/common/scriptcore/tolua_game.pkg

Modified: trunk/common/scriptcore/api_game_methods.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/api_game_methods.c?rev=27059&r1=27058&r2=27059&view=diff
==============================================================================
--- trunk/common/scriptcore/api_game_methods.c  (original)
+++ trunk/common/scriptcore/api_game_methods.c  Mon Nov 17 11:28:54 2014
@@ -366,6 +366,19 @@
 }
 
 /*****************************************************************************
+  Return TRUE if players share research.
+*****************************************************************************/
+bool api_methods_player_shares_research(lua_State *L, Player *pplayer,
+                                        Player *aplayer)
+{
+  LUASCRIPT_CHECK_STATE(L, FALSE);
+  LUASCRIPT_CHECK_SELF(L, pplayer, FALSE);
+  LUASCRIPT_CHECK_ARG_NIL(L, aplayer, 3, Player, FALSE);
+
+  return research_get(pplayer) == research_get(aplayer);
+}
+
+/*****************************************************************************
   Return list head for unit list for Player
 *****************************************************************************/
 Unit_List_Link *api_methods_private_player_unit_list_head(lua_State *L,

Modified: trunk/common/scriptcore/api_game_methods.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/api_game_methods.h?rev=27059&r1=27058&r2=27059&view=diff
==============================================================================
--- trunk/common/scriptcore/api_game_methods.h  (original)
+++ trunk/common/scriptcore/api_game_methods.h  Mon Nov 17 11:28:54 2014
@@ -75,6 +75,8 @@
 int api_methods_player_gold(lua_State *L, Player *pplayer);
 bool api_methods_player_knows_tech(lua_State *L, Player *pplayer,
                                    Tech_Type *ptech);
+bool api_methods_player_shares_research(lua_State *L, Player *pplayer,
+                                        Player *aplayer);
 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: trunk/common/scriptcore/tolua_game.pkg
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/tolua_game.pkg?rev=27059&r1=27058&r2=27059&view=diff
==============================================================================
--- trunk/common/scriptcore/tolua_game.pkg      (original)
+++ trunk/common/scriptcore/tolua_game.pkg      Mon Nov 17 11:28:54 2014
@@ -134,6 +134,8 @@
     @ gold (lua_State *L, Player *self);
   bool api_methods_player_knows_tech
     @ 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);
 
   int api_methods_player_culture_get
     @ culture(lua_State *L, Player *self);


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

Reply via email to