Hooks
static bool BeforeCvGrandStrategyAI_Init(CvGrandStrategyAI* self, CvAIGrandStrategyXMLEntries* pAIGrandStrategies, CvPlayer* pPlayer);static void AfterCvGrandStrategyAI_Init(CvGrandStrategyAI* self, CvAIGrandStrategyXMLEntries* pAIGrandStrategies, CvPlayer* pPlayer);static void ReplaceCvGrandStrategyAI_Init(void (*original)(CvGrandStrategyAI*, CvAIGrandStrategyXMLEntries*, CvPlayer*), CvGrandStrategyAI* self, CvAIGrandStrategyXMLEntries* pAIGrandStrategies, CvPlayer* pPlayer);CivRegisterBefore<CivHooks::CvGrandStrategyAI_Init>(host, &BeforeCvGrandStrategyAI_Init);CivRegisterAfter<CivHooks::CvGrandStrategyAI_Init>(host, &AfterCvGrandStrategyAI_Init);CivRegisterReplace<CivHooks::CvGrandStrategyAI_Init>(host, &ReplaceCvGrandStrategyAI_Init);
Code
136/// Initialize137void CvGrandStrategyAI::Init(CvAIGrandStrategyXMLEntries* pAIGrandStrategies, CvPlayer* pPlayer)138{139 // Store off the pointer to the AIStrategies active for this game140 m_pAIGrandStrategies = pAIGrandStrategies;141142 m_pPlayer = pPlayer;143144 // Initialize AIGrandStrategy status array145 FAssertMsg(m_paiGrandStrategyPriority==NULL, "about to leak memory, CvGrandStrategyAI::m_paiGrandStrategyPriority");146 m_paiGrandStrategyPriority = FNEW(int[m_pAIGrandStrategies->GetNumAIGrandStrategies()], c_eCiv5GameplayDLL, 0);147148 FAssertMsg(m_eGuessOtherPlayerActiveGrandStrategy==NULL, "about to leak memory, CvGrandStrategyAI::m_eGuessOtherPlayerActiveGrandStrategy");149 m_eGuessOtherPlayerActiveGrandStrategy = FNEW(int[MAX_MAJOR_CIVS], c_eCiv5GameplayDLL, 0);150151 FAssertMsg(m_eGuessOtherPlayerActiveGrandStrategyConfidence==NULL, "about to leak memory, CvGrandStrategyAI::m_eGuessOtherPlayerActiveGrandStrategyConfidence");152 m_eGuessOtherPlayerActiveGrandStrategyConfidence = FNEW(int[MAX_MAJOR_CIVS], c_eCiv5GameplayDLL, 0);153154 Reset();155}