Hooks
static bool BeforeCvLuaDeal_lIsPossibleToTradeItem(lua_State* L, int& result);static void AfterCvLuaDeal_lIsPossibleToTradeItem(lua_State* L, int& result);static int ReplaceCvLuaDeal_lIsPossibleToTradeItem(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaDeal_lIsPossibleToTradeItem>(host, &BeforeCvLuaDeal_lIsPossibleToTradeItem);CivRegisterAfter<CivHooks::CvLuaDeal_lIsPossibleToTradeItem>(host, &AfterCvLuaDeal_lIsPossibleToTradeItem);CivRegisterReplace<CivHooks::CvLuaDeal_lIsPossibleToTradeItem>(host, &ReplaceCvLuaDeal_lIsPossibleToTradeItem);
Code
123int CvLuaDeal::lIsPossibleToTradeItem(lua_State* L)124{125 CvDeal* pkDeal = GetInstance(L);126 const PlayerTypes eFromPlayer = (PlayerTypes) lua_tointeger(L, 2);127 const PlayerTypes eToPlayer = (PlayerTypes) lua_tointeger(L, 3);128 const TradeableItems eItem = (TradeableItems) lua_tointeger(L, 4);129 const int iData1 = lua_tointeger(L, 5);130 const int iData2 = lua_tointeger(L, 6);131 const int iData3 = lua_tointeger(L, 7);132 const bool bFlag1 = lua_toboolean(L, 8);133134 const bool bResult = pkDeal->IsPossibleToTradeItem(eFromPlayer, eToPlayer, eItem, iData1, iData2, iData3, bFlag1);135 lua_pushboolean(L, bResult);136 return 1;137}