Bazaar developer reference

CvMilitaryAI::ThreatIncrease(ThreatTypes, ThreatTypes)

Defined in
CvMilitaryAI.cpp, line 2415
Class
CvMilitaryAI
Hook name
CivHooks::CvMilitaryAI_ThreatIncrease

Hooks

static bool BeforeCvMilitaryAI_ThreatIncrease(CvMilitaryAI* self, ThreatTypes eNewThreat, ThreatTypes eOldThreat);static void AfterCvMilitaryAI_ThreatIncrease(CvMilitaryAI* self, ThreatTypes eNewThreat, ThreatTypes eOldThreat);static void ReplaceCvMilitaryAI_ThreatIncrease(void (*original)(CvMilitaryAI*, ThreatTypes, ThreatTypes), CvMilitaryAI* self, ThreatTypes eNewThreat, ThreatTypes eOldThreat);CivRegisterBefore<CivHooks::CvMilitaryAI_ThreatIncrease>(host, &BeforeCvMilitaryAI_ThreatIncrease);CivRegisterAfter<CivHooks::CvMilitaryAI_ThreatIncrease>(host, &AfterCvMilitaryAI_ThreatIncrease);CivRegisterReplace<CivHooks::CvMilitaryAI_ThreatIncrease>(host, &ReplaceCvMilitaryAI_ThreatIncrease);

Code

2414/// Respond to an increased threat2415void CvMilitaryAI::ThreatIncrease(ThreatTypes eNewThreat, ThreatTypes eOldThreat)2416{2417	// Subtract off old threat2418	m_iTotalThreatWeight -= GetThreatWeight(eOldThreat);24192420	// Add on new threat2421	m_iTotalThreatWeight += GetThreatWeight(eNewThreat);24222423	// FUTURE: Add anything else we'd like to do to individually handle new threats from a single power2424}

Calls

Called by