Bazaar developer reference

CvGrandStrategyAI::GetGuessOtherPlayerCulturePriority(PlayerTypes, int, int)

Defined in
CvGrandStrategyAI.cpp, line 1061
Class
CvGrandStrategyAI
Hook name
CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerCulturePriority

Hooks

static bool BeforeCvGrandStrategyAI_GetGuessOtherPlayerCulturePriority(CvGrandStrategyAI* self, PlayerTypes ePlayer, int iWorldCultureAverage, int iWorldTourismAverage, int& result);static void AfterCvGrandStrategyAI_GetGuessOtherPlayerCulturePriority(CvGrandStrategyAI* self, PlayerTypes ePlayer, int iWorldCultureAverage, int iWorldTourismAverage, int& result);static int ReplaceCvGrandStrategyAI_GetGuessOtherPlayerCulturePriority(int (*original)(CvGrandStrategyAI*, PlayerTypes, int, int), CvGrandStrategyAI* self, PlayerTypes ePlayer, int iWorldCultureAverage, int iWorldTourismAverage);CivRegisterBefore<CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerCulturePriority>(host, &BeforeCvGrandStrategyAI_GetGuessOtherPlayerCulturePriority);CivRegisterAfter<CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerCulturePriority>(host, &AfterCvGrandStrategyAI_GetGuessOtherPlayerCulturePriority);CivRegisterReplace<CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerCulturePriority>(host, &ReplaceCvGrandStrategyAI_GetGuessOtherPlayerCulturePriority);

Code

1060/// Guess as to how much another Player is prioritizing Culture as his means of winning the game1061int CvGrandStrategyAI::GetGuessOtherPlayerCulturePriority(PlayerTypes ePlayer, int iWorldCultureAverage, int iWorldTourismAverage)1062{1063	VictoryTypes eVictory = (VictoryTypes) GC.getInfoTypeForString("VICTORY_CULTURAL", true);10641065	// If Culture Victory isn't even available then don't bother with anything1066	if(eVictory == NO_VICTORY)1067	{1068		return -100;1069	}10701071	int iCulturePriority = 0;1072	int iRatio;10731074	// Compare their Culture to the world average; Possible range is 75 to -751075	if(iWorldCultureAverage > 0)1076	{1077		iRatio = (GET_PLAYER(ePlayer).GetJONSCultureEverGenerated() - iWorldCultureAverage) * /*75*/ GC.getAI_GS_CULTURE_RATIO_MULTIPLIER() / iWorldCultureAverage;1078		if (iRatio > GC.getAI_GS_CULTURE_RATIO_MULTIPLIER())1079		{1080			iCulturePriority += GC.getAI_GS_CULTURE_RATIO_MULTIPLIER();1081		}1082		else if (iRatio < -GC.getAI_GS_CULTURE_RATIO_MULTIPLIER())1083		{1084			iCulturePriority += -GC.getAI_GS_CULTURE_RATIO_MULTIPLIER();1085		}1086		iCulturePriority += iRatio;1087	}10881089	// Compare their Tourism to the world average; Possible range is 75 to -751090	if(iWorldTourismAverage > 0)1091	{1092		iRatio = (GET_PLAYER(ePlayer).GetCulture()->GetTourism() - iWorldTourismAverage) * /*75*/ GC.getAI_GS_TOURISM_RATIO_MULTIPLIER() / iWorldTourismAverage;1093		if (iRatio > GC.getAI_GS_TOURISM_RATIO_MULTIPLIER())1094		{1095			iCulturePriority += GC.getAI_GS_TOURISM_RATIO_MULTIPLIER();1096		}1097		else if (iRatio < -GC.getAI_GS_TOURISM_RATIO_MULTIPLIER())1098		{1099			iCulturePriority += -GC.getAI_GS_TOURISM_RATIO_MULTIPLIER();1100		}1101		iCulturePriority += iRatio;	}11021103	return iCulturePriority;1104}

Calls

Called by