Hooks
static bool BeforeCvPlayerTechs_Write(CvPlayerTechs* self, FDataStream& kStream);static void AfterCvPlayerTechs_Write(CvPlayerTechs* self, FDataStream& kStream);static void ReplaceCvPlayerTechs_Write(void (*original)(CvPlayerTechs*, FDataStream&), CvPlayerTechs* self, FDataStream& kStream);CivRegisterBefore<CivHooks::CvPlayerTechs_Write>(host, &BeforeCvPlayerTechs_Write);CivRegisterAfter<CivHooks::CvPlayerTechs_Write>(host, &AfterCvPlayerTechs_Write);CivRegisterReplace<CivHooks::CvPlayerTechs_Write>(host, &ReplaceCvPlayerTechs_Write);
Code
851/// Serialization write852void CvPlayerTechs::Write(FDataStream& kStream)853{854 // Current version number855 uint uiVersion = 1;856 kStream << uiVersion;857 MOD_SERIALIZE_INIT_WRITE(kStream);858859 // TODO: If m_pTechs is NULL then the stream will not advance860 CvAssertMsg(m_pTechs != NULL && m_pTechs->GetNumTechs() > 0, "Number of techs to serialize is expected to greater than 0");861 if(m_pTechs != NULL)862 {863 const int iNumTechs = m_pTechs->GetNumTechs();864865 CvInfosSerializationHelper::WriteHashedDataArray<TechTypes, bool>(kStream, m_pabResearchingTech, iNumTechs);866 CvInfosSerializationHelper::WriteHashedDataArray<TechTypes, int>(kStream, m_piCivTechPriority, iNumTechs);867 CvInfosSerializationHelper::WriteHashedDataArray<TechTypes, int>(kStream, m_piLocaleTechPriority, iNumTechs);868 CvInfosSerializationHelper::WriteHashedDataArray<TechTypes, ResourceTypes>(kStream, m_peLocaleTechResources, iNumTechs);869 CvInfosSerializationHelper::WriteHashedDataArray<TechTypes, UnitTypes>(kStream, m_peCivTechUniqueUnits, iNumTechs);870 CvInfosSerializationHelper::WriteHashedDataArray<TechTypes, BuildingTypes>(kStream, m_peCivTechUniqueBuildings, iNumTechs);871 CvInfosSerializationHelper::WriteHashedDataArray<TechTypes, ImprovementTypes>(kStream, m_peCivTechUniqueImprovements, iNumTechs);872 }873874 // Now for AI875 m_pTechAI->Write(kStream);876877 CvAssertMsg(m_piLatestFlavorValues != NULL && GC.getNumFlavorTypes() > 0, "Number of flavor values to serialize is expected to greater than 0");878 kStream << GC.getNumFlavorTypes();879 kStream << ArrayWrapper<int>(GC.getNumFlavorTypes(), m_piLatestFlavorValues);880}