Hooks
static bool BeforeCvGame_SetVoteCast(CvGame* self, TeamTypes eVotingTeam, TeamTypes eVote, bool bPreliminaryVote);static void AfterCvGame_SetVoteCast(CvGame* self, TeamTypes eVotingTeam, TeamTypes eVote, bool bPreliminaryVote);static void ReplaceCvGame_SetVoteCast(void (*original)(CvGame*, TeamTypes, TeamTypes, bool), CvGame* self, TeamTypes eVotingTeam, TeamTypes eVote, bool bPreliminaryVote);CivRegisterBefore<CivHooks::CvGame_SetVoteCast>(host, &BeforeCvGame_SetVoteCast);CivRegisterAfter<CivHooks::CvGame_SetVoteCast>(host, &AfterCvGame_SetVoteCast);CivRegisterReplace<CivHooks::CvGame_SetVoteCast>(host, &ReplaceCvGame_SetVoteCast);
Code
5355/// Have eVotingTeam cast its UN vote for eVote5356/// Preliminary votes will be counted, but will not trigger victory5357void CvGame::SetVoteCast(TeamTypes eVotingTeam, TeamTypes eVote, bool bPreliminaryVote)5358{5359 CvAssertMsg(eVotingTeam >= 0, "eMajor is expected to be non-negative (invalid Index)");5360 CvAssertMsg(eVotingTeam < MAX_CIV_TEAMS, "eMajor is expected to be within maximum bounds (invalid Index)");53615362 if(eVote != GetVoteCast(eVotingTeam))5363 {5364 m_aiVotesCast[eVotingTeam] = eVote;53655366 // Increment counts (unless we're resetting)5367 if(eVote != NO_TEAM)5368 {5369 int iNumVotes = 1;53705371 ChangeNumVotesForTeam(eVote, iNumVotes);53725373 // Must call this last, as when enough votes are tallied the election ends immediately5374 ChangeNumVictoryVotesTallied(1, bPreliminaryVote);5375 }5376 }5377}