Hooks
static bool BeforeCvPlayerTechs_Init(CvPlayerTechs* self, CvTechXMLEntries* pTechs, CvPlayer* pPlayer, bool bIsCity);static void AfterCvPlayerTechs_Init(CvPlayerTechs* self, CvTechXMLEntries* pTechs, CvPlayer* pPlayer, bool bIsCity);static void ReplaceCvPlayerTechs_Init(void (*original)(CvPlayerTechs*, CvTechXMLEntries*, CvPlayer*, bool), CvPlayerTechs* self, CvTechXMLEntries* pTechs, CvPlayer* pPlayer, bool bIsCity);CivRegisterBefore<CivHooks::CvPlayerTechs_Init>(host, &BeforeCvPlayerTechs_Init);CivRegisterAfter<CivHooks::CvPlayerTechs_Init>(host, &AfterCvPlayerTechs_Init);CivRegisterReplace<CivHooks::CvPlayerTechs_Init>(host, &ReplaceCvPlayerTechs_Init);
Code
633/// Initialize634void CvPlayerTechs::Init(CvTechXMLEntries* pTechs, CvPlayer* pPlayer, bool bIsCity)635{636 // Init base class637 CvFlavorRecipient::Init();638639 // Store off the pointers to objects we'll need later640 m_bIsCity = bIsCity;641 m_pTechs = pTechs;642 m_pPlayer = pPlayer;643644 // Initialize arrays645 const int iNumTechs = m_pTechs->GetNumTechs();646647 CvAssertMsg(m_pabResearchingTech==NULL, "about to leak memory, CvPlayerTechs::m_pabResearchingTech");648 m_pabResearchingTech = FNEW(bool[iNumTechs], c_eCiv5GameplayDLL, 0);649 CvAssertMsg(m_piCivTechPriority==NULL, "about to leak memory, CvPlayerTechs::m_piCivTechPriority");650 m_piCivTechPriority = FNEW(int[iNumTechs], c_eCiv5GameplayDLL, 0);651 CvAssertMsg(m_piLocaleTechPriority==NULL, "about to leak memory, CvPlayerTechs::m_piLocaleTechPriority");652 m_piLocaleTechPriority = FNEW(int[iNumTechs], c_eCiv5GameplayDLL, 0);653 CvAssertMsg(m_peLocaleTechResources==NULL, "about to leak memory, CvPlayerTechs::m_peLocaleTechResources");654 m_peLocaleTechResources = FNEW(ResourceTypes[iNumTechs], c_eCiv5GameplayDLL, 0);655 CvAssertMsg(m_peCivTechUniqueUnits==NULL, "about to leak memory, CvPlayerTechs::m_peCivTechUniqueUnits");656 m_peCivTechUniqueUnits = FNEW(UnitTypes[iNumTechs], c_eCiv5GameplayDLL, 0);657 CvAssertMsg(m_peCivTechUniqueBuildings==NULL, "about to leak memory, CvPlayerTechs::m_peCivTechUniqueBuildings");658 m_peCivTechUniqueBuildings = FNEW(BuildingTypes[iNumTechs], c_eCiv5GameplayDLL, 0);659 CvAssertMsg(m_peCivTechUniqueImprovements==NULL, "about to leak memory, CvPlayerTechs::m_peCivTechUniqueImprovements");660 m_peCivTechUniqueImprovements = FNEW(ImprovementTypes[iNumTechs], c_eCiv5GameplayDLL, 0);661662 // Create AI object663 m_pTechAI = FNEW(CvTechAI(this), c_eCiv5GameplayDLL, 0);664665 Reset();666}