From 1e8456a3b115d161a54b734a30f1685ea32b66fc Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 18 Mar 2023 18:37:31 +0200 Subject: [PATCH 19/19] Lua: Add Player:infrapoints() method See osdn #47456 Signed-off-by: Marko Lindqvist --- common/scriptcore/api_game_methods.c | 11 +++++++++++ common/scriptcore/api_game_methods.h | 1 + common/scriptcore/tolua_game.pkg | 2 ++ 3 files changed, 14 insertions(+) diff --git a/common/scriptcore/api_game_methods.c b/common/scriptcore/api_game_methods.c index 106b91a473..942ae2a599 100644 --- a/common/scriptcore/api_game_methods.c +++ b/common/scriptcore/api_game_methods.c @@ -500,6 +500,17 @@ int api_methods_player_gold(lua_State *L, Player *pplayer) return pplayer->economic.gold; } +/**********************************************************************//** + Return amount of infrapoints Player has +**************************************************************************/ +int api_methods_player_infrapoints(lua_State *L, Player *pplayer) +{ + LUASCRIPT_CHECK_STATE(L, 0); + LUASCRIPT_CHECK_SELF(L, pplayer, 0); + + return pplayer->economic.infra_points; +} + /**********************************************************************//** Return TRUE if Player knows advance ptech. **************************************************************************/ diff --git a/common/scriptcore/api_game_methods.h b/common/scriptcore/api_game_methods.h index 755587c81d..6fcdb388db 100644 --- a/common/scriptcore/api_game_methods.h +++ b/common/scriptcore/api_game_methods.h @@ -85,6 +85,7 @@ int api_methods_player_number(lua_State *L, Player *pplayer); int api_methods_player_num_cities(lua_State *L, Player *pplayer); int api_methods_player_num_units(lua_State *L, Player *pplayer); int api_methods_player_gold(lua_State *L, Player *pplayer); +int api_methods_player_infrapoints(lua_State *L, Player *pplayer); bool api_methods_player_knows_tech(lua_State *L, Player *pplayer, Tech_Type *ptech); bool api_method_player_can_research(lua_State *L, Player *pplayer, diff --git a/common/scriptcore/tolua_game.pkg b/common/scriptcore/tolua_game.pkg index 64ed11d6f6..588e9abcba 100644 --- a/common/scriptcore/tolua_game.pkg +++ b/common/scriptcore/tolua_game.pkg @@ -186,6 +186,8 @@ module Player { @ has_wonder (lua_State *L, Player *self, Building_Type *building); int api_methods_player_gold @ gold (lua_State *L, Player *self); + int api_methods_player_infrapoints + @ infrapoints (lua_State *L, Player *self); bool api_methods_player_knows_tech @ knows_tech (lua_State *L, Player *self, Tech_Type *ptech); bool api_method_player_can_research -- 2.39.2