Bazaar developer reference

CvCityStrategyAI::FlavorUpdate()

Defined in
CvCityStrategyAI.cpp, line 380
Class
CvCityStrategyAI
Hook name
CivHooks::CvCityStrategyAI_FlavorUpdate
Overrides
CvFlavorRecipient::FlavorUpdate()

Hooks

static bool BeforeCvCityStrategyAI_FlavorUpdate(CvCityStrategyAI* self);static void AfterCvCityStrategyAI_FlavorUpdate(CvCityStrategyAI* self);static void ReplaceCvCityStrategyAI_FlavorUpdate(void (*original)(CvCityStrategyAI*), CvCityStrategyAI* self);CivRegisterBefore<CivHooks::CvCityStrategyAI_FlavorUpdate>(host, &BeforeCvCityStrategyAI_FlavorUpdate);CivRegisterAfter<CivHooks::CvCityStrategyAI_FlavorUpdate>(host, &AfterCvCityStrategyAI_FlavorUpdate);CivRegisterReplace<CivHooks::CvCityStrategyAI_FlavorUpdate>(host, &ReplaceCvCityStrategyAI_FlavorUpdate);

Code

379/// Respond to a new set of flavor values380void CvCityStrategyAI::FlavorUpdate()381{382	// Reset our sub AI objects383	m_pBuildingProductionAI->Reset();384	m_pUnitProductionAI->Reset();385	m_pProjectProductionAI->Reset();386	m_pProcessProductionAI->Reset();387388	// Broadcast to our sub AI objects389	for(int iFlavor = 0; iFlavor < GC.getNumFlavorTypes(); iFlavor++)390	{391		int iFlavorValue = GetLatestFlavorValue((FlavorTypes)iFlavor);// m_piLatestFlavorValues[iFlavor];392393		m_pBuildingProductionAI->AddFlavorWeights((FlavorTypes)iFlavor, iFlavorValue);394		m_pUnitProductionAI->AddFlavorWeights((FlavorTypes)iFlavor, iFlavorValue);395		m_pProjectProductionAI->AddFlavorWeights((FlavorTypes)iFlavor, iFlavorValue);396		m_pProcessProductionAI->AddFlavorWeights((FlavorTypes)iFlavor, iFlavorValue);397	}398}

Calls

Called by