Bazaar developer reference

CvPolicyAI::IsBranchEffectiveInGame(PolicyBranchTypes)

Defined in
CvPolicyAI.cpp, line 864
Class
CvPolicyAI
Hook name
CivHooks::CvPolicyAI_IsBranchEffectiveInGame

Hooks

static bool BeforeCvPolicyAI_IsBranchEffectiveInGame(CvPolicyAI* self, PolicyBranchTypes eBranch, bool& result);static void AfterCvPolicyAI_IsBranchEffectiveInGame(CvPolicyAI* self, PolicyBranchTypes eBranch, bool& result);static bool ReplaceCvPolicyAI_IsBranchEffectiveInGame(bool (*original)(CvPolicyAI*, PolicyBranchTypes), CvPolicyAI* self, PolicyBranchTypes eBranch);CivRegisterBefore<CivHooks::CvPolicyAI_IsBranchEffectiveInGame>(host, &BeforeCvPolicyAI_IsBranchEffectiveInGame);CivRegisterAfter<CivHooks::CvPolicyAI_IsBranchEffectiveInGame>(host, &AfterCvPolicyAI_IsBranchEffectiveInGame);CivRegisterReplace<CivHooks::CvPolicyAI_IsBranchEffectiveInGame>(host, &ReplaceCvPolicyAI_IsBranchEffectiveInGame);

Code

863/// Based on game options (religion off, science off, etc.), would this branch do us any good?864bool CvPolicyAI::IsBranchEffectiveInGame(PolicyBranchTypes eBranch)865{866	CvPolicyBranchEntry* pBranchInfo = GC.getPolicyBranchInfo(eBranch);867	CvAssertMsg(pBranchInfo, "Branch info not found! Please send Anton your save file and version.");868	if (!pBranchInfo) return false;869	870	if (pBranchInfo->IsDelayWhenNoReligion())871		if (GC.getGame().isOption(GAMEOPTION_NO_RELIGION))872			return false;873874	if (pBranchInfo->IsDelayWhenNoCulture())875		if (GC.getGame().isOption(GAMEOPTION_NO_POLICIES))876			return false;877878	if (pBranchInfo->IsDelayWhenNoScience())879		if (GC.getGame().isOption(GAMEOPTION_NO_SCIENCE))880			return false;881882	if (pBranchInfo->IsDelayWhenNoCityStates())883		if (GC.getGame().GetNumMinorCivsEver() <= 0)884			return false;885886	return true;887}

Calls

Called by