Hooks
static bool BeforeCvLuaUnit_lGetBestInterceptor(lua_State* L, int& result);static void AfterCvLuaUnit_lGetBestInterceptor(lua_State* L, int& result);static int ReplaceCvLuaUnit_lGetBestInterceptor(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaUnit_lGetBestInterceptor>(host, &BeforeCvLuaUnit_lGetBestInterceptor);CivRegisterAfter<CivHooks::CvLuaUnit_lGetBestInterceptor>(host, &AfterCvLuaUnit_lGetBestInterceptor);CivRegisterReplace<CivHooks::CvLuaUnit_lGetBestInterceptor>(host, &ReplaceCvLuaUnit_lGetBestInterceptor);
Code
2698//CvUnit* GetBestInterceptor( CvPlot* pPlot, CvUnit *pDefender, bool bLandInterceptorsOnly, bool bVisibleInterceptorsOnly);2699int CvLuaUnit::lGetBestInterceptor(lua_State* L)2700{2701 CvUnit* pkUnit = GetInstance(L);2702 CvPlot* pkPlot = CvLuaPlot::GetInstance(L, 2);2703 CvUnit* pkDefender = GetInstance(L, 3, false);2704 const bool bLandInterceptorsOnly = lua_toboolean(L, 4);2705 const bool bVisibleInterceptorsOnly = lua_toboolean(L, 5);27062707 CvUnit* pkBestUnit = 0;2708 if(pkPlot)2709 {2710 pkBestUnit = pkUnit->GetBestInterceptor(*pkPlot, pkDefender, bLandInterceptorsOnly, bVisibleInterceptorsOnly);2711 }27122713 CvLuaUnit::Push(L, pkBestUnit);2714 return 1;2715}