Hooks
static bool BeforeCvLuaPlayer_lInitCity(lua_State* L, int& result);static void AfterCvLuaPlayer_lInitCity(lua_State* L, int& result);static int ReplaceCvLuaPlayer_lInitCity(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaPlayer_lInitCity>(host, &BeforeCvLuaPlayer_lInitCity);CivRegisterAfter<CivHooks::CvLuaPlayer_lInitCity>(host, &AfterCvLuaPlayer_lInitCity);CivRegisterReplace<CivHooks::CvLuaPlayer_lInitCity>(host, &ReplaceCvLuaPlayer_lInitCity);
Code
1199//CvCity* initCity(int x, int y, bBumpUnits = true);1200int CvLuaPlayer::lInitCity(lua_State* L)1201{1202 CvPlayerAI* pkPlayer = GetInstance(L);1203 const int x = lua_tointeger(L, 2);1204 const int y = lua_tointeger(L, 3);1205 const bool bBumpUnits = luaL_optint(L, 4, 1);1206 const bool bInitialFounding = luaL_optint(L, 5, 1);1207#if defined(MOD_API_LUA_EXTENSIONS)1208 const ReligionTypes eInitialReligion = (ReligionTypes) luaL_optint(L, 6, NO_RELIGION);12091210 CvCity* pkCity = pkPlayer->initCity(x, y, bBumpUnits, bInitialFounding, eInitialReligion);1211#else1212 CvCity* pkCity = pkPlayer->initCity(x, y, bBumpUnits, bInitialFounding);1213#endif1214 pkPlayer->DoUpdateNextPolicyCost();1215 CvLuaCity::Push(L, pkCity);1216 return 1;1217}