Bazaar developer reference

CvLeagueAI::ScoreVoteChoice(CvEnactProposal *, int)

Defined in
CvVotingClasses.cpp, line 8831
Class
CvLeagueAI
Hook name
CivHooks::CvLeagueAI_ScoreVoteChoice

Hooks

static bool BeforeCvLeagueAI_ScoreVoteChoice(CvLeagueAI* self, CvEnactProposal* pProposal, int iChoice, int& result);static void AfterCvLeagueAI_ScoreVoteChoice(CvLeagueAI* self, CvEnactProposal* pProposal, int iChoice, int& result);static int ReplaceCvLeagueAI_ScoreVoteChoice(int (*original)(CvLeagueAI*, CvEnactProposal*, int), CvLeagueAI* self, CvEnactProposal* pProposal, int iChoice);CivRegisterBefore<CivHooks::CvLeagueAI_ScoreVoteChoice>(host, &BeforeCvLeagueAI_ScoreVoteChoice);CivRegisterAfter<CivHooks::CvLeagueAI_ScoreVoteChoice>(host, &AfterCvLeagueAI_ScoreVoteChoice);CivRegisterReplace<CivHooks::CvLeagueAI_ScoreVoteChoice>(host, &ReplaceCvLeagueAI_ScoreVoteChoice);

Code

8830// Score a particular choice on a particular proposal8831int CvLeagueAI::ScoreVoteChoice(CvEnactProposal* pProposal, int iChoice)8832{8833	CvAssert(pProposal != NULL);8834	if (!(pProposal != NULL)) return 0;8835	CvAssert(GC.getGame().GetGameLeagues()->GetNumActiveLeagues() > 0);8836	if (!(GC.getGame().GetGameLeagues()->GetNumActiveLeagues() > 0)) return 0;8837	CvLeague* pLeague = GC.getGame().GetGameLeagues()->GetActiveLeague();8838	CvAssert(pLeague != NULL);8839	if (!(pLeague != NULL)) return 0;88408841	int iScore = 0;88428843	switch (pProposal->GetVoterDecision()->GetType())8844	{8845	case RESOLUTION_DECISION_YES_OR_NO:8846		{8847			iScore = ScoreVoteChoiceYesNo(pProposal, iChoice, /*bEnact*/ true);8848			break;8849		}8850	case RESOLUTION_DECISION_ANY_MEMBER:8851	case RESOLUTION_DECISION_MAJOR_CIV_MEMBER:8852	case RESOLUTION_DECISION_OTHER_MAJOR_CIV_MEMBER:8853		{8854			iScore = ScoreVoteChoicePlayer(pProposal, iChoice, /*bEnact*/ true);8855			break;8856		}8857	default:8858		{8859			CvAssertMsg(false, "Unexpected decision type when evaluating choices for AI on a proposed resolution.");8860			break;8861		}8862	}8863	8864	return iScore;8865}

Calls

Called by