Bazaar developer reference

CvRepealProposal::IsPassed(int)

Defined in
CvVotingClasses.cpp, line 1708
Class
CvRepealProposal
Hook name
CivHooks::CvRepealProposal_IsPassed
Overrides
CvProposal::IsPassed(int)

Hooks

static bool BeforeCvRepealProposal_IsPassed(CvRepealProposal* self, int iTotalSessionVotes, bool& result);static void AfterCvRepealProposal_IsPassed(CvRepealProposal* self, int iTotalSessionVotes, bool& result);static bool ReplaceCvRepealProposal_IsPassed(bool (*original)(CvRepealProposal*, int), CvRepealProposal* self, int iTotalSessionVotes);CivRegisterBefore<CivHooks::CvRepealProposal_IsPassed>(host, &BeforeCvRepealProposal_IsPassed);CivRegisterAfter<CivHooks::CvRepealProposal_IsPassed>(host, &AfterCvRepealProposal_IsPassed);CivRegisterReplace<CivHooks::CvRepealProposal_IsPassed>(host, &ReplaceCvRepealProposal_IsPassed);

Code

1708bool CvRepealProposal::IsPassed(int iTotalSessionVotes)1709{1710	CvResolutionEntry* pInfo = GC.getResolutionInfo(GetType());1711	CvAssert(pInfo);1712	if (!pInfo)1713	{1714		return false;1715	}17161717	int iQuorumPercent = pInfo->GetQuorumPercent();1718	bool bQuorum = ((float)GetRepealDecision()->GetVotesCast() / (float)iTotalSessionVotes) >= ((float)iQuorumPercent / 100.0f);1719	if (!bQuorum)1720	{1721		return false;1722	}17231724	int iDecision = GetRepealDecision()->GetDecision();1725	if (iDecision == LeagueHelpers::CHOICE_NONE)1726	{1727		// No votes, tied votes, etc.1728		return false;1729	}17301731	CvAssertMsg(GetRepealDecision()->GetType() == RESOLUTION_DECISION_REPEAL, "Unexpected decision type for repeal proposal. Please send Anton your save file and version.");1732	if (GetRepealDecision()->GetType() == RESOLUTION_DECISION_REPEAL)1733	{1734		return (iDecision == LeagueHelpers::CHOICE_YES);1735	}1736	else1737	{1738		return false;1739	}1740}

Calls

Called by