Bazaar developer reference

CvLeague::DoVoteEnact(int, PlayerTypes, int, int)

Defined in
CvVotingClasses.cpp, line 2223
Class
CvLeague
Hook name
CivHooks::CvLeague_DoVoteEnact

Hooks

static bool BeforeCvLeague_DoVoteEnact(CvLeague* self, int iID, PlayerTypes eVoter, int iNumVotes, int iChoice);static void AfterCvLeague_DoVoteEnact(CvLeague* self, int iID, PlayerTypes eVoter, int iNumVotes, int iChoice);static void ReplaceCvLeague_DoVoteEnact(void (*original)(CvLeague*, int, PlayerTypes, int, int), CvLeague* self, int iID, PlayerTypes eVoter, int iNumVotes, int iChoice);CivRegisterBefore<CivHooks::CvLeague_DoVoteEnact>(host, &BeforeCvLeague_DoVoteEnact);CivRegisterAfter<CivHooks::CvLeague_DoVoteEnact>(host, &AfterCvLeague_DoVoteEnact);CivRegisterReplace<CivHooks::CvLeague_DoVoteEnact>(host, &ReplaceCvLeague_DoVoteEnact);

Code

2223void CvLeague::DoVoteEnact(int iID, PlayerTypes eVoter, int iNumVotes, int iChoice)2224{2225	bool bProcessed = false;2226	if (CanVote(eVoter) && GetRemainingVotesForMember(eVoter) >= iNumVotes)2227	{2228		for (EnactProposalList::iterator it = m_vEnactProposals.begin(); it != m_vEnactProposals.end(); it++)2229		{2230			if (it->GetID() == iID)2231			{2232				it->GetVoterDecision()->ProcessVote(eVoter, iNumVotes, iChoice);2233				GetMember(eVoter)->iVotes -= iNumVotes;2234				CvAssertMsg(GetRemainingVotesForMember(eVoter) >= 0, "A voter now has negative votes remaining. Please send Anton your save file and version.");2235				bProcessed = true;2236				break;2237			}2238		}2239	}2240	CvAssertMsg(bProcessed, "Attempt to vote on an enact resolution when not allowed to. Please send Anton your save file and version.");2241	GC.GetEngineUserInterface()->setDirty(LeagueScreen_DIRTY_BIT, true);2242}

Calls

Called by