Bazaar developer reference

CvLeague::GetTurnsUntilVictorySession()

Defined in
CvVotingClasses.cpp, line 2090
Class
CvLeague
Hook name
CivHooks::CvLeague_GetTurnsUntilVictorySession

Hooks

static bool BeforeCvLeague_GetTurnsUntilVictorySession(CvLeague* self, int& result);static void AfterCvLeague_GetTurnsUntilVictorySession(CvLeague* self, int& result);static int ReplaceCvLeague_GetTurnsUntilVictorySession(int (*original)(CvLeague*), CvLeague* self);CivRegisterBefore<CivHooks::CvLeague_GetTurnsUntilVictorySession>(host, &BeforeCvLeague_GetTurnsUntilVictorySession);CivRegisterAfter<CivHooks::CvLeague_GetTurnsUntilVictorySession>(host, &AfterCvLeague_GetTurnsUntilVictorySession);CivRegisterReplace<CivHooks::CvLeague_GetTurnsUntilVictorySession>(host, &ReplaceCvLeague_GetTurnsUntilVictorySession);

Code

2090int CvLeague::GetTurnsUntilVictorySession()2091{2092	VictoryTypes eDiploVictory = (VictoryTypes) GC.getInfoTypeForString("VICTORY_DIPLOMATIC", true);2093	if (eDiploVictory == NO_VICTORY)2094	{2095		return 999;2096	}2097	if (!GC.getGame().isVictoryValid(eDiploVictory))2098	{2099		return 999;2100	}21012102	int iValue = 999;21032104	bool bVictoryProposed = false;2105	for (EnactProposalList::iterator it = m_vEnactProposals.begin(); it != m_vEnactProposals.end(); ++it)2106	{2107		if (it->GetEffects()->bDiplomaticVictory)2108		{2109			bVictoryProposed = true;2110		}2111	}21122113	// Is victory already proposed?2114	if (bVictoryProposed)2115	{2116		iValue = GetTurnsUntilSession();2117	}2118	// Is there a recurring victory proposal, for the following session?2119	else2120	{2121		LeagueSpecialSessionTypes eGoverningSpecialSession = NO_LEAGUE_SPECIAL_SESSION;2122		if (GetCurrentSpecialSession() != NO_LEAGUE_SPECIAL_SESSION)2123		{2124			eGoverningSpecialSession = GetCurrentSpecialSession();2125		}2126		else if (GetLastSpecialSession() != NO_LEAGUE_SPECIAL_SESSION)2127		{2128			eGoverningSpecialSession = GetLastSpecialSession();2129		}2130		CvAssert(eGoverningSpecialSession != NO_LEAGUE_SPECIAL_SESSION);21312132		bool bRecurringVictoryProposal = false;2133		if (eGoverningSpecialSession != NO_LEAGUE_SPECIAL_SESSION)2134		{2135			CvLeagueSpecialSessionEntry* pInfo = GC.getLeagueSpecialSessionInfo(eGoverningSpecialSession);2136			CvAssert(pInfo != NULL);2137			if (pInfo != NULL)2138			{2139				ResolutionTypes e = pInfo->GetRecurringProposal();2140				if (e != NO_RESOLUTION)2141				{2142					CvResolutionEntry* p = GC.getResolutionInfo(e);2143					if (p != NULL && p->IsDiplomaticVictory())2144					{2145						bRecurringVictoryProposal = true;2146					}2147				}2148			}2149		}21502151		if (bRecurringVictoryProposal)2152		{2153			// Time until next session, plus the interval until the following session2154			iValue = GetTurnsUntilSession() + GetSessionTurnInterval();2155		}2156	}21572158	return iValue;2159}

Calls

Called by