Hooks
static bool BeforeCvLuaPlayer_lCanConstruct(lua_State* L, int& result);static void AfterCvLuaPlayer_lCanConstruct(lua_State* L, int& result);static int ReplaceCvLuaPlayer_lCanConstruct(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaPlayer_lCanConstruct>(host, &BeforeCvLuaPlayer_lCanConstruct);CivRegisterAfter<CivHooks::CvLuaPlayer_lCanConstruct>(host, &AfterCvLuaPlayer_lCanConstruct);CivRegisterReplace<CivHooks::CvLuaPlayer_lCanConstruct>(host, &ReplaceCvLuaPlayer_lCanConstruct);
Code
1712//bool canConstruct(BuildingTypes eBuilding, bool bContinue, bool bTestVisible, bool bIgnoreCost);1713int CvLuaPlayer::lCanConstruct(lua_State* L)1714{1715 CvPlayerAI* pkPlayer = GetInstance(L);1716 const int iBuilding = lua_tointeger(L, 2);1717 const bool bContinue = luaL_optint(L, 3, 0);1718 const bool bTestVisible = luaL_optint(L, 4, 0);1719 const bool bIgnoreCost = luaL_optint(L, 5, 0);1720 const bool bResult = pkPlayer->canConstruct((BuildingTypes)iBuilding, bContinue, bTestVisible, bIgnoreCost);17211722 lua_pushboolean(L, bResult);1723 return 1;1724}