Bazaar developer reference

CvAchievementUnlocker::Check_PSG()

Defined in
CvAchievementUnlocker.cpp, line 32
Class
CvAchievementUnlocker
Hook name
CivHooks::CvAchievementUnlocker_Check_PSG

Hooks

static bool BeforeCvAchievementUnlocker_Check_PSG(bool& result);static void AfterCvAchievementUnlocker_Check_PSG(bool& result);static bool ReplaceCvAchievementUnlocker_Check_PSG(bool (*original)());CivRegisterBefore<CivHooks::CvAchievementUnlocker_Check_PSG>(host, &BeforeCvAchievementUnlocker_Check_PSG);CivRegisterAfter<CivHooks::CvAchievementUnlocker_Check_PSG>(host, &AfterCvAchievementUnlocker_Check_PSG);CivRegisterReplace<CivHooks::CvAchievementUnlocker_Check_PSG>(host, &ReplaceCvAchievementUnlocker_Check_PSG);

Code

31//	Test the conditions for the ACHIEVEMENT_PSG32bool CvAchievementUnlocker::Check_PSG()33{34#if !defined(NO_ACHIEVEMENTS)35	const int PSG_STAT_MATCH_VALUE = 100;3637	int32 iGeneralsStat = 0;38	int32 iWinsStat = 0;39	int32 iArmyStat = 0;40	if(gDLL->GetSteamStat(ESTEAMSTAT_GREATGENERALS, &iGeneralsStat) &&41	        gDLL->GetSteamStat(ESTEAMSTAT_TOTAL_WINS, &iWinsStat) &&42	        gDLL->GetSteamStat(ESTEAMSTAT_STANDINGARMY, &iArmyStat))43	{44		if(iGeneralsStat >= PSG_STAT_MATCH_VALUE && iWinsStat >= PSG_STAT_MATCH_VALUE && iArmyStat >= PSG_STAT_MATCH_VALUE)45		{46			gDLL->UnlockAchievement(ACHIEVEMENT_PSG);47			return true;48		}49	}50#endif51	return false;52}