Hooks
static bool BeforeCvPlayerEspionage_AddSpyMessage(CvPlayerEspionage* self, int iCityX, int iCityY, PlayerTypes eAttackingPlayer, int iSpyResult, TechTypes eStolenTech);static void AfterCvPlayerEspionage_AddSpyMessage(CvPlayerEspionage* self, int iCityX, int iCityY, PlayerTypes eAttackingPlayer, int iSpyResult, TechTypes eStolenTech);static void ReplaceCvPlayerEspionage_AddSpyMessage(void (*original)(CvPlayerEspionage*, int, int, PlayerTypes, int, TechTypes), CvPlayerEspionage* self, int iCityX, int iCityY, PlayerTypes eAttackingPlayer, int iSpyResult, TechTypes eStolenTech);CivRegisterBefore<CivHooks::CvPlayerEspionage_AddSpyMessage>(host, &BeforeCvPlayerEspionage_AddSpyMessage);CivRegisterAfter<CivHooks::CvPlayerEspionage_AddSpyMessage>(host, &AfterCvPlayerEspionage_AddSpyMessage);CivRegisterReplace<CivHooks::CvPlayerEspionage_AddSpyMessage>(host, &ReplaceCvPlayerEspionage_AddSpyMessage);
Code
2753/// AddMessage - This function is called by another player's PlayerEspionage class. It records the spy activity to be played back at the beginning2754/// of the turn. This prevents notifications from coming in during someone's turn, allowing players to game the system by watching when2755/// the messages come in to determine which player did the spying.2756void CvPlayerEspionage::AddSpyMessage(int iCityX, int iCityY, PlayerTypes eAttackingPlayer, int iSpyResult, TechTypes eStolenTech)2757{2758 // go through all messages to see if this is an update2759 for(uint ui = 0; ui < m_aSpyNotificationMessages.size(); ui++)2760 {2761 if(m_aSpyNotificationMessages[ui].m_iCityX == iCityX && m_aSpyNotificationMessages[ui].m_iCityY == iCityY && m_aSpyNotificationMessages[ui].m_eAttackingPlayer == eAttackingPlayer)2762 {2763 m_aSpyNotificationMessages[ui].m_iSpyResult = iSpyResult;2764 m_aSpyNotificationMessages[ui].m_eStolenTech = eStolenTech;2765 // found the appropriate message, now leaving the function2766 return;2767 }2768 }27692770 // no matching message found so adding it to the back of the list2771 SpyNotificationMessage kMessage;2772 kMessage.m_iCityX = iCityX;2773 kMessage.m_iCityY = iCityY;2774 kMessage.m_eAttackingPlayer = eAttackingPlayer;2775 kMessage.m_iSpyResult = iSpyResult;2776 kMessage.m_eStolenTech = eStolenTech;2777 m_aSpyNotificationMessages.push_back(kMessage);2778}