Hooks
static bool BeforeCvLuaUnit_lCanEnterTerritory(lua_State* L, int& result);static void AfterCvLuaUnit_lCanEnterTerritory(lua_State* L, int& result);static int ReplaceCvLuaUnit_lCanEnterTerritory(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaUnit_lCanEnterTerritory>(host, &BeforeCvLuaUnit_lCanEnterTerritory);CivRegisterAfter<CivHooks::CvLuaUnit_lCanEnterTerritory>(host, &AfterCvLuaUnit_lCanEnterTerritory);CivRegisterReplace<CivHooks::CvLuaUnit_lCanEnterTerritory>(host, &ReplaceCvLuaUnit_lCanEnterTerritory);
Code
792//bool canEnterTerritory(int /*TeamTypes*/ eTeam, bool bIgnoreRightOfPassage = false, bool bIsCity = false);793int CvLuaUnit::lCanEnterTerritory(lua_State* L)794{795 CvUnit* pkUnit = GetInstance(L);796 const TeamTypes eTeam = (TeamTypes)lua_tointeger(L, 2);797 const bool bIgnoreRightOfPassage = luaL_optint(L, 3, 0);798 const bool bIsCity = luaL_optint(L, 4, 0);799800 const bool bResult = pkUnit->canEnterTerritory(eTeam, bIgnoreRightOfPassage, bIsCity);801802 lua_pushboolean(L, bResult);803 return 1;804}