Bazaar developer reference

CvLuaPlayer::lGetCoupChanceOfSuccess(lua_State *)

Defined in
Lua/CvLuaPlayer.cpp, line 11752
Class
CvLuaPlayer
Hook name
CivHooks::CvLuaPlayer_lGetCoupChanceOfSuccess

Hooks

static bool BeforeCvLuaPlayer_lGetCoupChanceOfSuccess(lua_State* L, int& result);static void AfterCvLuaPlayer_lGetCoupChanceOfSuccess(lua_State* L, int& result);static int ReplaceCvLuaPlayer_lGetCoupChanceOfSuccess(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaPlayer_lGetCoupChanceOfSuccess>(host, &BeforeCvLuaPlayer_lGetCoupChanceOfSuccess);CivRegisterAfter<CivHooks::CvLuaPlayer_lGetCoupChanceOfSuccess>(host, &AfterCvLuaPlayer_lGetCoupChanceOfSuccess);CivRegisterReplace<CivHooks::CvLuaPlayer_lGetCoupChanceOfSuccess>(host, &ReplaceCvLuaPlayer_lGetCoupChanceOfSuccess);

Code

11752int CvLuaPlayer::lGetCoupChanceOfSuccess(lua_State* L)11753{11754	CvPlayerAI* pkThisPlayer = GetInstance(L);11755	CvPlayerEspionage* pkPlayerEspionage = pkThisPlayer->GetEspionage();11756	CvCity* pkCity = CvLuaCity::GetInstance(L, 2);1175711758	int iSpyIndex = pkPlayerEspionage->GetSpyIndexInCity(pkCity);11759	CvAssertMsg(iSpyIndex >= 0, "iSpyIndex out of bounds");11760	if(iSpyIndex < 0)11761	{11762		lua_pushinteger(L, 0);11763		return 1;11764	}1176511766	lua_pushinteger(L, pkPlayerEspionage->GetCoupChanceOfSuccess(iSpyIndex));11767	return 1;11768}

Calls

Called by