Bazaar developer reference

CvLuaPlayer::lInitUnitWithNameOffset(lua_State *)

Defined in
Lua/CvLuaPlayer.cpp, line 1282
Class
CvLuaPlayer
Hook name
CivHooks::CvLuaPlayer_lInitUnitWithNameOffset

Hooks

static bool BeforeCvLuaPlayer_lInitUnitWithNameOffset(lua_State* L, int& result);static void AfterCvLuaPlayer_lInitUnitWithNameOffset(lua_State* L, int& result);static int ReplaceCvLuaPlayer_lInitUnitWithNameOffset(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaPlayer_lInitUnitWithNameOffset>(host, &BeforeCvLuaPlayer_lInitUnitWithNameOffset);CivRegisterAfter<CivHooks::CvLuaPlayer_lInitUnitWithNameOffset>(host, &AfterCvLuaPlayer_lInitUnitWithNameOffset);CivRegisterReplace<CivHooks::CvLuaPlayer_lInitUnitWithNameOffset>(host, &ReplaceCvLuaPlayer_lInitUnitWithNameOffset);

Code

1281//CvUnit* initUnitWithNameOffset(UnitTypes eUnit, int iX, int iY, UnitAITypes eUnitAI = NO_UNITAI, DirectionTypes eFacingDirection = NO_DIRECTION);1282int CvLuaPlayer::lInitUnitWithNameOffset(lua_State* L)1283{1284	CvPlayerAI* pkPlayer = GetInstance(L);1285	const UnitTypes eUnit = (UnitTypes)lua_tointeger(L, 2);1286	const int iNameOffset = lua_tointeger(L, 3);1287	const int x = lua_tointeger(L, 4);1288	const int y = lua_tointeger(L, 5);1289	const UnitAITypes eUnitAI = (UnitAITypes)luaL_optint(L, 6, NO_UNITAI);1290	const DirectionTypes eFacingDirection = (DirectionTypes)luaL_optint(L, 7, NO_DIRECTION);12911292	CvUnit* pkUnit = pkPlayer->initUnitWithNameOffset(eUnit, iNameOffset, x, y, eUnitAI, eFacingDirection);1293	CvLuaUnit::Push(L, pkUnit);1294	return 1;1295}

Calls

Called by