Bazaar developer reference

CvMilitaryAI::ThreatDecrease(ThreatTypes, ThreatTypes)

Defined in
CvMilitaryAI.cpp, line 2427
Class
CvMilitaryAI
Hook name
CivHooks::CvMilitaryAI_ThreatDecrease

Hooks

static bool BeforeCvMilitaryAI_ThreatDecrease(CvMilitaryAI* self, ThreatTypes eNewThreat, ThreatTypes eOldThreat);static void AfterCvMilitaryAI_ThreatDecrease(CvMilitaryAI* self, ThreatTypes eNewThreat, ThreatTypes eOldThreat);static void ReplaceCvMilitaryAI_ThreatDecrease(void (*original)(CvMilitaryAI*, ThreatTypes, ThreatTypes), CvMilitaryAI* self, ThreatTypes eNewThreat, ThreatTypes eOldThreat);CivRegisterBefore<CivHooks::CvMilitaryAI_ThreatDecrease>(host, &BeforeCvMilitaryAI_ThreatDecrease);CivRegisterAfter<CivHooks::CvMilitaryAI_ThreatDecrease>(host, &AfterCvMilitaryAI_ThreatDecrease);CivRegisterReplace<CivHooks::CvMilitaryAI_ThreatDecrease>(host, &ReplaceCvMilitaryAI_ThreatDecrease);

Code

2426/// React to a decreased in threat2427void CvMilitaryAI::ThreatDecrease(ThreatTypes eNewThreat, ThreatTypes eOldThreat)2428{2429	// Subtract off old threat2430	m_iTotalThreatWeight -= GetThreatWeight(eOldThreat);24312432	// Add on new threat2433	m_iTotalThreatWeight += GetThreatWeight(eNewThreat);24342435	// FUTURE: Add anything else we'd like to do to individually handle diminishing threats from a single power2436}

Calls

Called by