Bazaar developer reference

CvLeagueAI::DoVoteCommitments(CvLeague *)

Defined in
CvVotingClasses.cpp, line 7913
Class
CvLeagueAI
Hook name
CivHooks::CvLeagueAI_DoVoteCommitments

Hooks

static bool BeforeCvLeagueAI_DoVoteCommitments(CvLeagueAI* self, CvLeague* pLeague);static void AfterCvLeagueAI_DoVoteCommitments(CvLeagueAI* self, CvLeague* pLeague);static void ReplaceCvLeagueAI_DoVoteCommitments(void (*original)(CvLeagueAI*, CvLeague*), CvLeagueAI* self, CvLeague* pLeague);CivRegisterBefore<CivHooks::CvLeagueAI_DoVoteCommitments>(host, &BeforeCvLeagueAI_DoVoteCommitments);CivRegisterAfter<CivHooks::CvLeagueAI_DoVoteCommitments>(host, &AfterCvLeagueAI_DoVoteCommitments);CivRegisterReplace<CivHooks::CvLeagueAI_DoVoteCommitments>(host, &ReplaceCvLeagueAI_DoVoteCommitments);

Code

7912// Honor our vote commitments7913void CvLeagueAI::DoVoteCommitments(CvLeague* pLeague)7914{7915	for (VoteCommitmentList::iterator it = m_vVoteCommitmentList.begin(); it != m_vVoteCommitmentList.end(); ++it)7916	{7917		CvAssertMsg(pLeague->CanVote(GetPlayer()->GetID()), "Trying to honor vote commitments but not able to vote. Please send Anton your save file and version.");7918		CvAssertMsg(pLeague->GetRemainingVotesForMember(GetPlayer()->GetID()) >= it->iNumVotes, "Trying to honor vote commitments but not enough votes. Please send Anton your save file and version.");7919		bool bProcessed = false;7920		if (pLeague->CanVote(GetPlayer()->GetID()))7921		{7922			// Proposal is up, time to honor the commitment7923			if (pLeague->IsProposed(it->iResolutionID, !it->bEnact, /*bCheckOnHold*/ false))7924			{7925				if (it->bEnact)7926				{7927					pLeague->DoVoteEnact(it->iResolutionID, GetPlayer()->GetID(), it->iNumVotes, it->iVoteChoice);7928					bProcessed = true;7929				}7930				else7931				{7932					pLeague->DoVoteRepeal(it->iResolutionID, GetPlayer()->GetID(), it->iNumVotes, it->iVoteChoice);7933					bProcessed = true;7934				}7935			}7936			// Proposal is on hold (ex. special session), so keep the commitment for once it comes back up7937			else if (pLeague->IsProposed(it->iResolutionID, !it->bEnact, /*bCheckOnHold*/ true))7938			{	7939			}7940			// Proposal is no longer around (ex. invalidated by a player being killed)7941			else7942			{7943				bProcessed = true;7944			}7945		}79467947		// Cleanup7948		if (bProcessed)7949		{7950			m_vVoteCommitmentList.erase(it);7951			it--;7952		}7953	}7954}

Calls

Called by