Author: sveinung Date: Sun Nov 13 16:43:01 2016 New Revision: 34496 URL: http://svn.gna.org/viewcvs/freeciv?rev=34496&view=rev Log: Lua API: introduce find.action() methods.
See patch #7973 Modified: trunk/common/scriptcore/api_game_find.c trunk/common/scriptcore/api_game_find.h trunk/common/scriptcore/tolua_game.pkg Modified: trunk/common/scriptcore/api_game_find.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/api_game_find.c?rev=34496&r1=34495&r2=34496&view=diff ============================================================================== --- trunk/common/scriptcore/api_game_find.c (original) +++ trunk/common/scriptcore/api_game_find.c Sun Nov 13 16:43:01 2016 @@ -173,6 +173,28 @@ return nation_by_rule_name(name_orig); } +/*************************************************************************** + Return the action type with the given action_id number. +***************************************************************************/ +Action *api_find_action(lua_State *L, int action_id) +{ + LUASCRIPT_CHECK_STATE(L, NULL); + + return action_by_number(action_id); +} + +/*************************************************************************** + Return the action with the given name_orig. +***************************************************************************/ +Action *api_find_action_by_name(lua_State *L, const char *name_orig) +{ + + LUASCRIPT_CHECK_STATE(L, NULL); + LUASCRIPT_CHECK_ARG_NIL(L, name_orig, 2, string, NULL); + + return action_by_rule_name(name_orig); +} + /***************************************************************************** Return the improvement type with the given impr_type_id index. *****************************************************************************/ Modified: trunk/common/scriptcore/api_game_find.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/api_game_find.h?rev=34496&r1=34495&r2=34496&view=diff ============================================================================== --- trunk/common/scriptcore/api_game_find.h (original) +++ trunk/common/scriptcore/api_game_find.h Sun Nov 13 16:43:01 2016 @@ -41,6 +41,8 @@ Nation_Type *api_find_nation_type(lua_State *L, int nation_type_id); Nation_Type *api_find_nation_type_by_name(lua_State *L, const char *name_orig); +Action *api_find_action(lua_State *L, int action_id); +Action *api_find_action_by_name(lua_State *L, const char *name_orig); Building_Type *api_find_building_type(lua_State *L, int building_type_id); Building_Type *api_find_building_type_by_name(lua_State *L, const char *name_orig); Modified: trunk/common/scriptcore/tolua_game.pkg URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/tolua_game.pkg?rev=34496&r1=34495&r2=34496&view=diff ============================================================================== --- trunk/common/scriptcore/tolua_game.pkg (original) +++ trunk/common/scriptcore/tolua_game.pkg Sun Nov 13 16:43:01 2016 @@ -458,6 +458,10 @@ @ nation_type (lua_State *L, const char *name_orig); Nation_Type *api_find_nation_type @ nation_type (lua_State *L, int nation_type_id); + Action *api_find_action_by_name + @ action (lua_State *L, const char *name_orig); + Action *api_find_action + @ action (lua_State *L, int building_type_id); Building_Type *api_find_building_type_by_name @ building_type (lua_State *L, const char *name_orig); Building_Type *api_find_building_type _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits