Bazaar developer reference

CvLuaUnit::lGetInterceptorCount(lua_State *)

Defined in
Lua/CvLuaUnit.cpp, line 2718
Class
CvLuaUnit
Hook name
CivHooks::CvLuaUnit_lGetInterceptorCount

Hooks

static bool BeforeCvLuaUnit_lGetInterceptorCount(lua_State* L, int& result);static void AfterCvLuaUnit_lGetInterceptorCount(lua_State* L, int& result);static int ReplaceCvLuaUnit_lGetInterceptorCount(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaUnit_lGetInterceptorCount>(host, &BeforeCvLuaUnit_lGetInterceptorCount);CivRegisterAfter<CivHooks::CvLuaUnit_lGetInterceptorCount>(host, &AfterCvLuaUnit_lGetInterceptorCount);CivRegisterReplace<CivHooks::CvLuaUnit_lGetInterceptorCount>(host, &ReplaceCvLuaUnit_lGetInterceptorCount);

Code

2717//CvUnit* GetInterceptor Count( CvPlot* pPlot, CvUnit *pDefender, bool bLandInterceptorsOnly, bool bVisibleInterceptorsOnly);2718int CvLuaUnit::lGetInterceptorCount(lua_State* L)2719{2720	CvUnit* pkUnit = GetInstance(L);2721	CvPlot* pkPlot = CvLuaPlot::GetInstance(L, 2);2722	CvUnit* pkDefender = GetInstance(L, 3, false);2723	const bool bLandInterceptorsOnly = lua_toboolean(L, 4);2724	const bool bVisibleInterceptorsOnly = lua_toboolean(L, 5);27252726	int iCount  = 0;2727	if(pkPlot)2728	{2729		iCount = pkUnit->GetInterceptorCount(*pkPlot, pkDefender, bLandInterceptorsOnly, bVisibleInterceptorsOnly);2730	}27312732	lua_pushinteger(L, iCount);2733	return 1;2734}

Calls

Called by