Bazaar developer reference

CvPlayerEspionage::LevelUpSpy(uint)

Defined in
CvEspionageClasses.cpp, line 1601
Class
CvPlayerEspionage
Hook name
CivHooks::CvPlayerEspionage_LevelUpSpy

Hooks

static bool BeforeCvPlayerEspionage_LevelUpSpy(CvPlayerEspionage* self, uint uiSpyIndex);static void AfterCvPlayerEspionage_LevelUpSpy(CvPlayerEspionage* self, uint uiSpyIndex);static void ReplaceCvPlayerEspionage_LevelUpSpy(void (*original)(CvPlayerEspionage*, uint), CvPlayerEspionage* self, uint uiSpyIndex);CivRegisterBefore<CivHooks::CvPlayerEspionage_LevelUpSpy>(host, &BeforeCvPlayerEspionage_LevelUpSpy);CivRegisterAfter<CivHooks::CvPlayerEspionage_LevelUpSpy>(host, &AfterCvPlayerEspionage_LevelUpSpy);CivRegisterReplace<CivHooks::CvPlayerEspionage_LevelUpSpy>(host, &ReplaceCvPlayerEspionage_LevelUpSpy);

Code

1600/// LevelUpSpy - Move spy to next experience level1601void CvPlayerEspionage::LevelUpSpy(uint uiSpyIndex)1602{1603	// if the spy can level up and it's not dead1604#if defined(MOD_API_ESPIONAGE)1605	if(m_aSpyList[uiSpyIndex].m_eRank < NUM_SPY_RANKS - 1 && !(m_aSpyList[uiSpyIndex].m_eSpyState == SPY_STATE_DEAD || m_aSpyList[uiSpyIndex].m_eSpyState == SPY_STATE_TERMINATED))1606#else1607	if(m_aSpyList[uiSpyIndex].m_eRank < NUM_SPY_RANKS - 1 && m_aSpyList[uiSpyIndex].m_eSpyState != SPY_STATE_DEAD)1608#endif1609	{1610		CvSpyRank eOriginalRank = m_aSpyList[uiSpyIndex].m_eRank;16111612		// announce promotion through notification1613		m_aSpyList[uiSpyIndex].m_eRank = (CvSpyRank)(m_aSpyList[uiSpyIndex].m_eRank + 1);16141615		CvNotifications* pNotifications = m_pPlayer->GetNotifications();1616		if(pNotifications)1617		{1618#if defined(MOD_BUGFIX_SPY_NAMES)1619			const char* szSpyName = m_aSpyList[uiSpyIndex].GetSpyName(m_pPlayer);1620#else1621			const char* szSpyName = m_pPlayer->getCivilizationInfo().getSpyNames(m_aSpyList[uiSpyIndex].m_iName);1622#endif1623			const char* szOldPromotion = GetSpyRankName(eOriginalRank);1624			const char* szNewPromotion = GetSpyRankName(m_aSpyList[uiSpyIndex].m_eRank);1625			CvString strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_SPY_PROMOTED", szSpyName, szOldPromotion, szNewPromotion);1626			CvString strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_SPY_PROMOTED", szSpyName);1627			pNotifications->Add(NOTIFICATION_SPY_PROMOTION, strBuffer, strSummary, -1, -1, 0);1628		}1629	}1630}

Calls

Called by