Bazaar developer reference

MilitaryAIHelpers::IsTestStrategy_EnoughMobileUnits(CvPlayer *, int, int)

Defined in
CvMilitaryAI.cpp, line 4826
Hook name
CivHooks::MilitaryAIHelpers_IsTestStrategy_EnoughMobileUnits

Hooks

static bool BeforeMilitaryAIHelpers_IsTestStrategy_EnoughMobileUnits(CvPlayer* pPlayer, int iNumMobile, int iNumMelee, bool& result);static void AfterMilitaryAIHelpers_IsTestStrategy_EnoughMobileUnits(CvPlayer* pPlayer, int iNumMobile, int iNumMelee, bool& result);static bool ReplaceMilitaryAIHelpers_IsTestStrategy_EnoughMobileUnits(bool (*original)(CvPlayer*, int, int), CvPlayer* pPlayer, int iNumMobile, int iNumMelee);CivRegisterBefore<CivHooks::MilitaryAIHelpers_IsTestStrategy_EnoughMobileUnits>(host, &BeforeMilitaryAIHelpers_IsTestStrategy_EnoughMobileUnits);CivRegisterAfter<CivHooks::MilitaryAIHelpers_IsTestStrategy_EnoughMobileUnits>(host, &AfterMilitaryAIHelpers_IsTestStrategy_EnoughMobileUnits);CivRegisterReplace<CivHooks::MilitaryAIHelpers_IsTestStrategy_EnoughMobileUnits>(host, &ReplaceMilitaryAIHelpers_IsTestStrategy_EnoughMobileUnits);

Code

4825/// "Enough Mobile" Player Strategy: If a player has too many mobile units4826bool MilitaryAIHelpers::IsTestStrategy_EnoughMobileUnits(CvPlayer* pPlayer, int iNumMobile, int iNumMelee)4827{4828	int iFlavorMobile = pPlayer->GetGrandStrategyAI()->GetPersonalityAndGrandStrategy((FlavorTypes)GC.getInfoTypeForString("FLAVOR_MOBILE"));4829	int iRatio = iNumMobile * 10 / max(1,iNumMelee+iNumMobile);4830	return (iRatio >= iFlavorMobile);4831}

Calls

Called by