Bazaar developer reference

PolicyHelpers::GetNumPlayersWithBranchUnlocked(PolicyBranchTypes)

Defined in
CvPolicyClasses.cpp, line 4812
Hook name
CivHooks::PolicyHelpers_GetNumPlayersWithBranchUnlocked

Hooks

static bool BeforePolicyHelpers_GetNumPlayersWithBranchUnlocked(PolicyBranchTypes eBranch, int& result);static void AfterPolicyHelpers_GetNumPlayersWithBranchUnlocked(PolicyBranchTypes eBranch, int& result);static int ReplacePolicyHelpers_GetNumPlayersWithBranchUnlocked(int (*original)(PolicyBranchTypes), PolicyBranchTypes eBranch);CivRegisterBefore<CivHooks::PolicyHelpers_GetNumPlayersWithBranchUnlocked>(host, &BeforePolicyHelpers_GetNumPlayersWithBranchUnlocked);CivRegisterAfter<CivHooks::PolicyHelpers_GetNumPlayersWithBranchUnlocked>(host, &AfterPolicyHelpers_GetNumPlayersWithBranchUnlocked);CivRegisterReplace<CivHooks::PolicyHelpers_GetNumPlayersWithBranchUnlocked>(host, &ReplacePolicyHelpers_GetNumPlayersWithBranchUnlocked);

Code

4812int PolicyHelpers::GetNumPlayersWithBranchUnlocked(PolicyBranchTypes eBranch)4813{4814	int iRtnValue = 0;48154816	for (int iI = 0; iI < MAX_CIV_PLAYERS; iI++)4817	{4818		CvPlayer &kPlayer = GET_PLAYER((PlayerTypes)iI);48194820		if (kPlayer.isAlive() && !kPlayer.isMinorCiv() && !kPlayer.isBarbarian())4821		{4822			if (kPlayer.GetPlayerPolicies()->IsPolicyBranchUnlocked(eBranch))4823			{4824				iRtnValue++;4825			}4826		}4827	}48284829	return iRtnValue;4830}

Calls

Called by