Bazaar developer reference

CvProcessProductionAI::Read(FDataStream &)

Defined in
CvProcessProductionAI.cpp, line 39
Class
CvProcessProductionAI
Hook name
CivHooks::CvProcessProductionAI_Read

Hooks

static bool BeforeCvProcessProductionAI_Read(CvProcessProductionAI* self, FDataStream& kStream);static void AfterCvProcessProductionAI_Read(CvProcessProductionAI* self, FDataStream& kStream);static void ReplaceCvProcessProductionAI_Read(void (*original)(CvProcessProductionAI*, FDataStream&), CvProcessProductionAI* self, FDataStream& kStream);CivRegisterBefore<CivHooks::CvProcessProductionAI_Read>(host, &BeforeCvProcessProductionAI_Read);CivRegisterAfter<CivHooks::CvProcessProductionAI_Read>(host, &AfterCvProcessProductionAI_Read);CivRegisterReplace<CivHooks::CvProcessProductionAI_Read>(host, &ReplaceCvProcessProductionAI_Read);

Code

38/// Serialization read39void CvProcessProductionAI::Read(FDataStream& kStream)40{41	// Version number to maintain backwards compatibility42	uint uiVersion;43	kStream >> uiVersion;44	MOD_SERIALIZE_INIT_READ(kStream);4546	int iWeight;4748	// Reset vector49	m_ProcessAIWeights.clear();50	m_ProcessAIWeights.resize(GC.getNumProcessInfos());51	for(int i = 0; i < GC.getNumProcessInfos(); ++i)52		m_ProcessAIWeights.SetWeight(i, 0);5354	// Loop through reading each one and adding it to our vector55	int iNumProcess;56	kStream >> iNumProcess;57	for(int i = 0; i < iNumProcess; i++)58	{59		int iType = CvInfosSerializationHelper::ReadHashed(kStream);60		kStream >> iWeight;61		if (iType >= 0 && iType < m_ProcessAIWeights.size())62			m_ProcessAIWeights.SetWeight(iType, iWeight);63	}64}

Calls

Called by