Author: jtn Date: Mon Nov 17 11:34:18 2014 New Revision: 27064 URL: http://svn.gna.org/viewcvs/freeciv?rev=27064&view=rev Log: Add new Lua function (Player):shares_research(Player).
See gna patch #5408. Modified: branches/S2_5/common/scriptcore/api_game_methods.c branches/S2_5/common/scriptcore/api_game_methods.h branches/S2_5/common/scriptcore/tolua_game.pkg Modified: branches/S2_5/common/scriptcore/api_game_methods.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/scriptcore/api_game_methods.c?rev=27064&r1=27063&r2=27064&view=diff ============================================================================== --- branches/S2_5/common/scriptcore/api_game_methods.c (original) +++ branches/S2_5/common/scriptcore/api_game_methods.c Mon Nov 17 11:34:18 2014 @@ -23,6 +23,7 @@ #include "map.h" #include "movement.h" #include "nation.h" +#include "research.h" #include "tech.h" #include "terrain.h" #include "tile.h" @@ -336,6 +337,19 @@ LUASCRIPT_CHECK_ARG_NIL(L, ptech, 3, Tech_Type, FALSE); return player_invention_state(pplayer, advance_number(ptech)) == TECH_KNOWN; +} + +/***************************************************************************** + 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 player_research_get(pplayer) == player_research_get(aplayer); } /***************************************************************************** Modified: branches/S2_5/common/scriptcore/api_game_methods.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/scriptcore/api_game_methods.h?rev=27064&r1=27063&r2=27064&view=diff ============================================================================== --- branches/S2_5/common/scriptcore/api_game_methods.h (original) +++ branches/S2_5/common/scriptcore/api_game_methods.h Mon Nov 17 11:34:18 2014 @@ -73,6 +73,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: branches/S2_5/common/scriptcore/tolua_game.pkg URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/scriptcore/tolua_game.pkg?rev=27064&r1=27063&r2=27064&view=diff ============================================================================== --- branches/S2_5/common/scriptcore/tolua_game.pkg (original) +++ branches/S2_5/common/scriptcore/tolua_game.pkg Mon Nov 17 11:34:18 2014 @@ -126,6 +126,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); } module methods_private { _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits