Bazaar developer reference

CvLeague::GetContributionTierThreshold(ContributionTier, LeagueProjectTypes)

Defined in
CvVotingClasses.cpp, line 3814
Class
CvLeague
Hook name
CivHooks::CvLeague_GetContributionTierThreshold

Hooks

static bool BeforeCvLeague_GetContributionTierThreshold(CvLeague* self, CvLeague::ContributionTier eTier, LeagueProjectTypes eLeagueProject, float& result);static void AfterCvLeague_GetContributionTierThreshold(CvLeague* self, CvLeague::ContributionTier eTier, LeagueProjectTypes eLeagueProject, float& result);static float ReplaceCvLeague_GetContributionTierThreshold(float (*original)(CvLeague*, CvLeague::ContributionTier, LeagueProjectTypes), CvLeague* self, CvLeague::ContributionTier eTier, LeagueProjectTypes eLeagueProject);CivRegisterBefore<CivHooks::CvLeague_GetContributionTierThreshold>(host, &BeforeCvLeague_GetContributionTierThreshold);CivRegisterAfter<CivHooks::CvLeague_GetContributionTierThreshold>(host, &AfterCvLeague_GetContributionTierThreshold);CivRegisterReplace<CivHooks::CvLeague_GetContributionTierThreshold>(host, &ReplaceCvLeague_GetContributionTierThreshold);

Code

3813// Get the contribution value which a player needs to meet or exceed to qualify for a reward tier level3814float CvLeague::GetContributionTierThreshold(ContributionTier eTier, LeagueProjectTypes eLeagueProject)3815{3816	float fThreshold = 0.0f;3817	Project* pProject = GetProject(eLeagueProject);3818	CvAssertMsg(pProject, "Could not find league project. Please send Anton your save file and version.");3819	if (!pProject) return 0.0f;38203821	switch (eTier)3822	{3823	case CONTRIBUTION_TIER_1:3824		{3825			fThreshold = GC.getLEAGUE_PROJECT_REWARD_TIER_1_THRESHOLD() * GetProjectCostPerPlayer(eLeagueProject);3826			break;3827		}3828	case CONTRIBUTION_TIER_2:3829		{3830			fThreshold = GC.getLEAGUE_PROJECT_REWARD_TIER_2_THRESHOLD() * GetProjectCostPerPlayer(eLeagueProject);3831			break;3832		}3833	case CONTRIBUTION_TIER_3:3834		{3835			int iBestContribution = 0;3836			for (uint i = 0; i < pProject->vProductionList.size(); i++)3837			{3838				int iContribution = pProject->vProductionList[i];3839				if (iContribution > iBestContribution && GET_PLAYER((PlayerTypes)i).isAlive() && IsMember((PlayerTypes)i))3840				{3841					iBestContribution = iContribution;3842				}3843			}3844			fThreshold = MAX((float)iBestContribution, GC.getLEAGUE_PROJECT_REWARD_TIER_2_THRESHOLD() * GetProjectCostPerPlayer(eLeagueProject));3845			break;3846		}3847	default:3848		break;3849	}3850	return fThreshold;3851}

Calls

Called by