Bazaar developer reference

CvLuaUnit::lChangeExperience(lua_State *)

Defined in
Lua/CvLuaUnit.cpp, line 3876
Class
CvLuaUnit
Hook name
CivHooks::CvLuaUnit_lChangeExperience

Hooks

static bool BeforeCvLuaUnit_lChangeExperience(lua_State* L, int& result);static void AfterCvLuaUnit_lChangeExperience(lua_State* L, int& result);static int ReplaceCvLuaUnit_lChangeExperience(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaUnit_lChangeExperience>(host, &BeforeCvLuaUnit_lChangeExperience);CivRegisterAfter<CivHooks::CvLuaUnit_lChangeExperience>(host, &AfterCvLuaUnit_lChangeExperience);CivRegisterReplace<CivHooks::CvLuaUnit_lChangeExperience>(host, &ReplaceCvLuaUnit_lChangeExperience);

Code

3875//void changeExperience(int iChange, int iMax = -1, bool bFromCombat = false, bool bInBorders = false, bool bUpdateGlobal = false);3876int CvLuaUnit::lChangeExperience(lua_State* L)3877{3878	CvUnit* pkUnit = GetInstance(L);3879	const int iChange = lua_tointeger(L, 2);3880	const int iMax = luaL_optint(L, 3, -1);3881	const bool bFromCombat = luaL_optint(L, 4, 0);3882	const bool bInBorders = luaL_optint(L, 5, 0);3883	const bool bUpdateGlobal = luaL_optint(L, 6, 0);38843885#if defined(MOD_UNITS_XP_TIMES_100)3886	pkUnit->changeExperienceTimes100(iChange * 100, iMax, bFromCombat, bInBorders, bUpdateGlobal);3887#else3888	pkUnit->changeExperience(iChange, iMax, bFromCombat, bInBorders, bUpdateGlobal);3889#endif3890	return 0;3891}

Calls

Called by