Пример #1
0
void CDynamicItems::fileAvailable(const CFileDescription& fileDescription, NLMISC::IStream& dataStream)
{
	static CPersistentDataRecord	pdr;
	pdr.clear();

	pdr.fromBuffer(dataStream);
	apply(pdr, 0);
}
void COutpostManager::outpostFileCallback(const CFileDescription& fileDescription, NLMISC::IStream& dataStream)
{
	// get the corresponding outpost
	string aliasStr = CFile::getFilename(fileDescription.FileName);
	aliasStr.resize( aliasStr.length() - 4 );
	aliasStr = aliasStr.substr( 8);

	TAIAlias alias;
	NLMISC::fromString(aliasStr, alias);
	COutpost * outpost = getOutpostFromAlias( alias );
	if ( !outpost )
		OUTPOST_WRN("Invalid outpost file '%s' %s : not found in the primitive", fileDescription.FileName.c_str(), CPrimitivesParser::aliasToString(alias).c_str());
	else
	{
		// load dynamic data
		static CPersistentDataRecord	pdr;
		pdr.clear();
		pdr.fromBuffer(dataStream);
		outpost->apply( pdr );
		loadedOutposts.push_back( outpost );
	}
}