Hooks
static bool BeforeCvLuaPlayer_lGetFriendshipFromUnitGift(lua_State* L, int& result);static void AfterCvLuaPlayer_lGetFriendshipFromUnitGift(lua_State* L, int& result);static int ReplaceCvLuaPlayer_lGetFriendshipFromUnitGift(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaPlayer_lGetFriendshipFromUnitGift>(host, &BeforeCvLuaPlayer_lGetFriendshipFromUnitGift);CivRegisterAfter<CivHooks::CvLuaPlayer_lGetFriendshipFromUnitGift>(host, &AfterCvLuaPlayer_lGetFriendshipFromUnitGift);CivRegisterReplace<CivHooks::CvLuaPlayer_lGetFriendshipFromUnitGift>(host, &ReplaceCvLuaPlayer_lGetFriendshipFromUnitGift);
Code
7181//int GetFriendshipFromUnitGift(PlayerTypes eMajor, bool bGreatPerson, bool bDistanceGift);7182int CvLuaPlayer::lGetFriendshipFromUnitGift(lua_State* L)7183{7184 CvPlayerAI* pkPlayer = GetInstance(L);7185 PlayerTypes eMajor = (PlayerTypes) lua_tointeger(L, 2);7186 bool bGreatPerson = lua_toboolean(L, 3);7187 bool bDistanceGift = lua_toboolean(L, 4);71887189 const int iResult = pkPlayer->GetMinorCivAI()->GetFriendshipFromUnitGift(eMajor, bGreatPerson, bDistanceGift);7190 lua_pushinteger(L, iResult);7191 return 1;7192}