Bazaar developer reference

LeagueHelpers::GetTextForChoice(ResolutionDecisionTypes, int)

Defined in
CvVotingClasses.cpp, line 26
Hook name
CivHooks::LeagueHelpers_GetTextForChoice

Hooks

static bool BeforeLeagueHelpers_GetTextForChoice(ResolutionDecisionTypes eDecision, int iChoice, CvString& result);static void AfterLeagueHelpers_GetTextForChoice(ResolutionDecisionTypes eDecision, int iChoice, CvString& result);static CvString ReplaceLeagueHelpers_GetTextForChoice(CvString (*original)(ResolutionDecisionTypes, int), ResolutionDecisionTypes eDecision, int iChoice);CivRegisterBefore<CivHooks::LeagueHelpers_GetTextForChoice>(host, &BeforeLeagueHelpers_GetTextForChoice);CivRegisterAfter<CivHooks::LeagueHelpers_GetTextForChoice>(host, &AfterLeagueHelpers_GetTextForChoice);CivRegisterReplace<CivHooks::LeagueHelpers_GetTextForChoice>(host, &ReplaceLeagueHelpers_GetTextForChoice);

Code

26CvString LeagueHelpers::GetTextForChoice(ResolutionDecisionTypes eDecision, int iChoice)27{28	CvString s = "";29	switch (eDecision)30	{31	case RESOLUTION_DECISION_YES_OR_NO:32	case RESOLUTION_DECISION_REPEAL:33		{34			CvAssertMsg(iChoice == CHOICE_NO || iChoice == CHOICE_YES, "Unexpected choice when handling a Yes/No decision. Please send Anton your save file and version.");35			if (iChoice == CHOICE_NO)36			{37				s = Localization::Lookup("TXT_KEY_RESOLUTION_CHOICE_NO").toUTF8();38			}39			else if (iChoice == CHOICE_YES)40			{41				s = Localization::Lookup("TXT_KEY_RESOLUTION_CHOICE_YES").toUTF8();42			}43			break;44		}45	case RESOLUTION_DECISION_ANY_MEMBER:46	case RESOLUTION_DECISION_MAJOR_CIV_MEMBER:47	case RESOLUTION_DECISION_OTHER_MAJOR_CIV_MEMBER:48		{49			CvAssertMsg(iChoice >= 0 && iChoice < MAX_CIV_PLAYERS, "Unexpected choice when handling a decision on a player. Please send Anton your save file and version.");50			if (iChoice >= 0 && iChoice < MAX_CIV_PLAYERS)51			{52				Localization::String sTemp = Localization::Lookup("TXT_KEY_RESOLUTION_CHOICE_PLAYER");53				sTemp << GET_PLAYER((PlayerTypes)iChoice).getCivilizationShortDescriptionKey();54				s = sTemp.toUTF8();55			}56			break;57		}58	case RESOLUTION_DECISION_CITY:59		{60			s = Localization::Lookup("TXT_KEY_RESOLUTION_CHOICE_CITY").toUTF8();61			break;62		}63	case RESOLUTION_DECISION_ANY_LUXURY_RESOURCE:64		{		65			CvResourceInfo* pInfo = GC.getResourceInfo((ResourceTypes)iChoice);66			CvAssertMsg(pInfo != NULL, "Unexpected choice when handling a decision on a resource. Please send Anton your save file and version.");67			if (pInfo != NULL)68			{69				Localization::String sTemp = Localization::Lookup("TXT_KEY_RESOLUTION_CHOICE_RESOURCE");70				sTemp << pInfo->GetIconString() << pInfo->GetDescriptionKey();71				s = sTemp.toUTF8();72			}73			break;74		}75	case RESOLUTION_DECISION_RELIGION:76		{77			CvReligionEntry* pInfo = GC.getReligionInfo((ReligionTypes)iChoice);78			CvAssertMsg(pInfo != NULL, "Unexpected choice when handling a decision on a religion. Please send Anton your save file and version.");79			const CvReligion* pReligion = GC.getGame().GetGameReligions()->GetReligion((ReligionTypes)iChoice, NO_PLAYER);80			CvAssert(pReligion != NULL);81			if (pInfo != NULL && pReligion != NULL)82			{83				Localization::String sTemp = Localization::Lookup("TXT_KEY_RESOLUTION_CHOICE_RELIGION");84				sTemp << pInfo->GetIconString() << pReligion->GetName();85				s = sTemp.toUTF8();86			}87			break;88		}89	case RESOLUTION_DECISION_IDEOLOGY:90		{91			CvPolicyBranchEntry* pInfo = GC.getPolicyBranchInfo((PolicyBranchTypes)iChoice);92			CvAssertMsg(pInfo != NULL, "Unexpected choice when handling a decision on an ideology. Please send Anton your save file and version.");93			if (pInfo != NULL)94			{95				Localization::String sTemp = Localization::Lookup("TXT_KEY_RESOLUTION_CHOICE_IDEOLOGY");96				sTemp << pInfo->GetDescriptionKey();97				s = sTemp.toUTF8();98			}99			break;100		}101	default:102		{103			break;104		}105	}106	return s;107}

Calls

Called by