Bazaar developer reference

CvLuaUnit::lCanEmbarkOnto(lua_State *)

Defined in
Lua/CvLuaUnit.cpp, line 1149
Class
CvLuaUnit
Hook name
CivHooks::CvLuaUnit_lCanEmbarkOnto

Hooks

static bool BeforeCvLuaUnit_lCanEmbarkOnto(lua_State* L, int& result);static void AfterCvLuaUnit_lCanEmbarkOnto(lua_State* L, int& result);static int ReplaceCvLuaUnit_lCanEmbarkOnto(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaUnit_lCanEmbarkOnto>(host, &BeforeCvLuaUnit_lCanEmbarkOnto);CivRegisterAfter<CivHooks::CvLuaUnit_lCanEmbarkOnto>(host, &AfterCvLuaUnit_lCanEmbarkOnto);CivRegisterReplace<CivHooks::CvLuaUnit_lCanEmbarkOnto>(host, &ReplaceCvLuaUnit_lCanEmbarkOnto);

Code

1148//bool CanEmbarkOnto(CvPlot* pPlot)1149int CvLuaUnit::lCanEmbarkOnto(lua_State* L)1150{1151	CvUnit* pkUnit = GetInstance(L);1152	CvPlot* pkOriginPlot = CvLuaPlot::GetInstance(L, 2);1153	CvPlot* pkTargetPlot = CvLuaPlot::GetInstance(L, 3);1154	bool bIsDestination = luaL_optbool(L, 4, true);		// Assume Lua is querying for a destination of the embark.  This will cause the test to fail if there is are stacking issues.1155	bool bResult = false;1156	if(pkOriginPlot && pkTargetPlot)1157	{1158		bResult = pkUnit->canEmbarkOnto(*pkOriginPlot, *pkTargetPlot, false, bIsDestination);1159	}11601161	lua_pushboolean(L, bResult);1162	return 1;1163}

Calls

Called by