Hooks
static bool BeforeCvLuaCity_lCanConstruct(lua_State* L, int& result);static void AfterCvLuaCity_lCanConstruct(lua_State* L, int& result);static int ReplaceCvLuaCity_lCanConstruct(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaCity_lCanConstruct>(host, &BeforeCvLuaCity_lCanConstruct);CivRegisterAfter<CivHooks::CvLuaCity_lCanConstruct>(host, &AfterCvLuaCity_lCanConstruct);CivRegisterReplace<CivHooks::CvLuaCity_lCanConstruct>(host, &ReplaceCvLuaCity_lCanConstruct);
Code
885//bool canConstruct( int iBuilding, bool bContinue, bool bTestVisible, bool bIgnoreCost);886int CvLuaCity::lCanConstruct(lua_State* L)887{888 CvCity* pkCity = GetInstance(L);889 const int iBuilding = lua_tointeger(L, 2);890 const bool bContinue = luaL_optint(L, 3, 0);891 const bool bTestVisible = luaL_optint(L, 4, 0);892 const bool bIgnoreCost = luaL_optint(L, 5, 0);893#if defined(MOD_API_EXTENSIONS)894 const bool bWillPurchase = luaL_optint(L, 6, 0);895 const bool bResult = pkCity->canConstruct((BuildingTypes)iBuilding, bContinue, bTestVisible, bIgnoreCost, bWillPurchase);896#else897 const bool bResult = pkCity->canConstruct((BuildingTypes)iBuilding, bContinue, bTestVisible, bIgnoreCost);898#endif899900 lua_pushboolean(L, bResult);901 return 1;902}