Bazaar developer reference

CvLuaPlayer::lGetUnhappinessForecast(lua_State *)

Defined in
Lua/CvLuaPlayer.cpp, line 3225
Class
CvLuaPlayer
Hook name
CivHooks::CvLuaPlayer_lGetUnhappinessForecast

Hooks

static bool BeforeCvLuaPlayer_lGetUnhappinessForecast(lua_State* L, int& result);static void AfterCvLuaPlayer_lGetUnhappinessForecast(lua_State* L, int& result);static int ReplaceCvLuaPlayer_lGetUnhappinessForecast(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaPlayer_lGetUnhappinessForecast>(host, &BeforeCvLuaPlayer_lGetUnhappinessForecast);CivRegisterAfter<CivHooks::CvLuaPlayer_lGetUnhappinessForecast>(host, &AfterCvLuaPlayer_lGetUnhappinessForecast);CivRegisterReplace<CivHooks::CvLuaPlayer_lGetUnhappinessForecast>(host, &ReplaceCvLuaPlayer_lGetUnhappinessForecast);

Code

3224//int GetUnhappinessForecast() const;3225int CvLuaPlayer::lGetUnhappinessForecast(lua_State* L)3226{3227	CvPlayerAI* pkPlayer = GetInstance(L);3228	CvCity* pkAssumeCityAnnexed = CvLuaCity::GetInstance(L, 2, false);3229	CvCity* pkAssumeCityPuppeted = CvLuaCity::GetInstance(L, 3, false);32303231	const int iUnhappiness = pkPlayer->GetUnhappiness(pkAssumeCityAnnexed, pkAssumeCityPuppeted);3232	lua_pushinteger(L, iUnhappiness);3233	return 1;3234}

Calls

Called by