void CScriptData::serial(NLMISC::IStream &f)
{
	uint16 size;
	if (f.isReading())
	{
		Scripts.clear();
		f.serial(size);

		uint32 i = 0;
		for (; i < size; ++i)
		{
			//std::string tmpKey;
			CCustomElementId tmpKey;
			std::vector<std::string> tmpVal;
			f.serial(tmpKey);
			f.serialCont(tmpVal);
			Scripts.insert(make_pair(tmpKey,tmpVal));
		}
	}
	else
	{
		size = (uint16)Scripts.size();
		f.serial(size);	
		for (TScripts::iterator it = Scripts.begin(); it != Scripts.end(); ++it)
		{
			//std::string tmp = it->first;			
			nlWrite(f, serial, it->first);
			nlWrite(f, serialCont, it->second);			
		}
	}
}
// ***************************************************************************
void CInterfaceConfig::dataBaseToStream (NLMISC::IStream &f)
{
	if (f.isReading())
	{
		nlwarning("stream is not in writing mode");
		return;
	}

	CInterfaceManager *pIM = CInterfaceManager::getInstance();

	// Save branch of the database
	SDBLeaf leafTmp;
	CCDBNodeBranch *pDB = pIM->getDbBranch ("UI:SAVE");
	if (pDB != NULL)
	{
		// Number of leaf to save
		uint32 nbLeaves = pDB->countLeaves();
		f.serial(nbLeaves);

		for (uint32 i = 0; i < nbLeaves; ++i)
		{
			uint count = i;
			CCDBNodeLeaf *pNL = pDB->findLeafAtCount(count);
			leafTmp.setFrom(pNL);
			f.serial(leafTmp);
		}
	}
}
void CStreamSound::serial(NLMISC::IStream &s)
{
	CSound::serial(s);

	s.serial(_MinDist);
	s.serial(m_Alpha);
}
void CCustomLootTable::serial(NLMISC::IStream &f)
{
	f.serial(LootSets);
	f.serial(MoneyFactor);
	f.serial(MoneyProba);
	f.serial(MoneyBase);
}
Example #5
0
// ***************************************************************************
void	CSkeletonShape::CLod::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	(void)f.serialVersion(0);

	f.serial(Distance);
	f.serialCont(ActiveBones);
}
void				CSimpleSound::serial(NLMISC::IStream &s)
{
	std::string bufferName;
	CSound::serial(s);

	s.serial(_MinDist);
	s.serial(_Alpha);

	if (s.isReading())
	{
		s.serial(bufferName);
		_Buffername = CStringMapper::map(bufferName);
		setBuffer(NULL);

		// contain % so it need a context to play
		if (bufferName.find ("%") != string::npos)
		{
			_NeedContext = true;
		}
	}
	else
	{
		bufferName = CStringMapper::unmap(_Buffername);
		s.serial(bufferName);
	}
}
void CCustomLootTableManager::serial(NLMISC::IStream &f)
{
	uint16 size;
	if (f.isReading())
	{	
		Tables.clear();
		f.serial(size);

		uint32 i = 0;
		for (; i < size; ++i)
		{
			//std::string tmpKey;
			CCustomElementId tmpKey;
			CCustomLootTable tmpVal;
			f.serial(tmpKey);
			f.serial(tmpVal);
			Tables.insert(make_pair(tmpKey,tmpVal));
		}
	}
	else
	{
		size = (uint16)Tables.size();
		f.serial(size);	
		for (TCustomLootTable::iterator it = Tables.begin(); it != Tables.end(); ++it)
		{
			nlWrite(f, serial, it->first);
			nlWrite(f, serial, it->second);
		}
	}
}
Example #8
0
// ---------------------------------------------------------------------------
void CZoneRegion::SZoneUnit2::serial (NLMISC::IStream &f)
{
	/*sint32 version =*/ f.serialVersion (0);

	SZoneUnit::serial (f);
	f.xmlSerial (DateLow, "LOW");
	f.xmlSerial (DateHigh, "HIGH");
}
Example #9
0
// ***************************************************************************
void			CSkills::serial(NLMISC::IStream &f)
{
    if (ShowDebugInChat) nlinfo("Skill are about to...");
    uint	ver= f.serialVersion(0);
    f.serialCont(_I16Skills);
    f.serialCont(_I16Tallies);
    if (ShowDebugInChat) nlinfo("Skills are in!");
}
// ***************************************************************************
void					CTrackSampledCommon::CTimeBlock::serial(NLMISC::IStream &f)
{
	(void)f.serialVersion(0);

	f.serial(TimeOffset);
	f.serial(KeyOffset);
	f.serial(Times);
}
Example #11
0
void	CPrimitivePlugin::TCreatureInfo::serial (NLMISC::IStream &s)
{
	s.serial(HaveRadius);
	s.serial(Radius);
	s.serial(HaveBox);
	s.serial(Width);
	s.serial(Length);
}
Example #12
0
void CBackgroundSound::serial(NLMISC::IStream &s)
{
	CSound::serial(s);

	s.serialCont(_Sounds);

	if (s.isReading())
		_DurationValid = false;
}
Example #13
0
void CModifierInDB::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	f.serial(Disabled);
	if(Disabled) 
	{
		f.serial(ActivationDate);
		f.serial(SheetId);
	}		
}
Example #14
0
// ***************************************************************************
void CShapeStream::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	// First, serial an header or checking if it is correct
	f.serialCheck (NELID("PAHS"));

	// Then, serial the shape
	f.serialPolyPtr (_Shape);

	// Ok, it's done
}
Example #15
0
///=======================================================================================
void CPSFloatCurveFunctor::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	f.serialVersion(1);
	f.serial(_NumSamples, _Smoothing);
	f.serialCont(_CtrlPoints);
	if (f.isReading())
	{
		updateTab();
	}
}
// ***************************************************************************
void			CAABBox::serial(NLMISC::IStream &f)
{
	/* ***********************************************
	 *	WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance
	 *	It can be loaded/called through CAsyncFileManager for instance
	 * ***********************************************/
	(void)f.serialVersion(0);
	f.serial(Center);
	f.serial(HalfSize);
}
Example #17
0
//***********************************************************************************************
void CParticleWorkspace::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	f.xmlPush("PARTICLE_WORKSPACE");
	f.serialVersion(0);
	f.xmlSerial(_Name, "NAME");	
	f.xmlPush("PS_LIST");
	uint32 numNodes = (uint32)_Nodes.size();
	// TODO : avoid to store the number of nodes
	f.xmlSerial(numNodes, "NUM_NODES");		
	if (f.isReading())
	{
		for(uint k = 0; k < numNodes; ++k)
		{		
			_Nodes.push_back(new CNode());						
			_Nodes.back()->init(this);
			f.serial(*_Nodes.back());
		}	
	}
	else
	{
		for(uint k = 0; k < numNodes; ++k)
		{
			f.serial(*_Nodes[k]);
		}		
	}
	f.xmlPop();
	f.xmlPop();
}
Example #18
0
// ***************************************************************************
void CCtrlBase::serial(NLMISC::IStream &f)
{
	CViewBase::serial(f);
	f.serial(_ContextHelp);
	f.serial(_OnContextHelp);
	f.serial(_OnContextHelpParams);
	f.serial(_ToolTipSpecialParent);
	f.serialEnum(_ToolTipParent);
	//

	THotSpot tmpToolTipParentPosRef = _ToolTipParentPosRef;
	THotSpot tmpToolTipPosRef = _ToolTipPosRef;
	THotSpot tmpToolTipParentPosRefAlt = _ToolTipParentPosRefAlt;
	THotSpot tmpToolTipPosRefAlt = _ToolTipPosRefAlt;

	f.serialEnum(tmpToolTipParentPosRef);
	f.serialEnum(tmpToolTipPosRef);
	f.serialEnum(tmpToolTipParentPosRefAlt);
	f.serialEnum(tmpToolTipPosRefAlt);

	_ToolTipParentPosRef = tmpToolTipParentPosRef;
	_ToolTipPosRef = tmpToolTipPosRef;
	_ToolTipParentPosRefAlt = tmpToolTipParentPosRefAlt;
	_ToolTipPosRefAlt = tmpToolTipPosRefAlt;	
	//
	nlSerialBitBool(f, _ToolTipInstant);	
}
Example #19
0
void CScenario::serial( NLMISC::IStream &f)
{
    // _Palette is not backuped because only on client side
    // There is no characters connected so _CurrentChars is not need,
    // _InstanceMap is set dynamically

    if ( f.isReading())
    {
        _Clean = false;
    }
    f.serialEnum(_SessionType);
    f.serial(_Mode);
    f.serial(_InitialActIndex);

    if (!f.isReading())
    {

        CObjectSerializerServer hl(_HighLevel);
        f.serial(hl);
        CObjectSerializerServer bb(_BasicBricks);
        f.serial(bb);
    }
    else
    {
        CObjectSerializerServer hl;
        f.serial(hl);
        CObjectSerializerServer bb;
        f.serial(bb);
        setHighLevel( hl.getData() ) ;	// Set instance Map
        delete _BasicBricks;
        _BasicBricks = bb.getData();
    }
}
Example #20
0
void		CContextSound::serial(NLMISC::IStream &s)
{
    CSound::serial(s);
    s.serial(_PatternName);

    if (s.isReading())
    {
        if (_ContextSounds)
            delete _ContextSounds;
    }
}
Example #21
0
// ***************************************************************************
void CMeshMorpher::serial (NLMISC::IStream &f) throw(NLMISC::EStream)
{
	/* ***********************************************
	 *	WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance
	 *	It can be loaded/called through CAsyncFileManager for instance
	 * ***********************************************/

	(void)f.serialVersion (0);

	f.serialCont (BlendShapes);
}
Example #22
0
size_t vorbisReadFunc(void *ptr, size_t size, size_t nmemb, void *datasource)
{
    CAudioDecoderVorbis *audio_decoder_vorbis = (CAudioDecoderVorbis *)datasource;
    NLMISC::IStream *stream = audio_decoder_vorbis->getStream();
    nlassert(stream->isReading());
    sint32 length = (sint32)(size * nmemb);
    if (length > audio_decoder_vorbis->getStreamSize() - stream->getPos())
        length = audio_decoder_vorbis->getStreamSize() - stream->getPos();
    stream->serialBuffer((uint8 *)ptr, length);
    return length;
}
Example #23
0
// ***************************************************************************
void			CMaterial::CLightMap::serial2(NLMISC::IStream &f)
{
	sint	ver= f.serialVersion(1);

	f.serial(Factor);
	f.serial(LMCDiffuse);
	if(ver>=1)
		f.serial(LMCAmbient);
	// Serial texture descriptor.
	Texture.serialPolyPtr(f);
}
// ***************************************************************************
void CInterfaceConfig::SDBLeaf::serial(NLMISC::IStream &f)
{
	// version 1 : added old value ( else some observers are not launched )
	// version 0 : base version
	sint ver = f.serialVersion(1);
	f.serial(Name);
	f.serial(Value);
	if (ver >= 1)
		f.serial(OldValue);
	else
		OldValue = Value;
}
Example #25
0
void CStreamSound::serial(NLMISC::IStream &s)
{
	CSound::serial(s);

	s.serial(_MinDist);
	s.serial(m_Alpha);

#if NLSOUND_SHEET_VERSION_BUILT < 2
	if (s.isReading()) _GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_STREAM_GROUP_CONTROLLER);
#endif

}
Example #26
0
/*
 * Serial Mapper
 */
void	CPDStringMapper::serial(NLMISC::IStream& f)
{
	f.serialCheck((uint32)'PDSM');

	uint	version = f.serialVersion(0);

	f.serialCont(_StringMap);

	if (f.isReading())
	{
		buildIdMap();
	}
}
Example #27
0
//-----------------------------------------------------------------------------
void CPowerActivationDateVector::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	if (f.isReading())
	{
		f.serialCont(PowerActivationDates);
		cleanVector();
	}
	else
	{
		cleanVector();
		f.serialCont(PowerActivationDates);
	}
}
// ***************************************************************************
void CStringMapper::localSerialString(NLMISC::IStream &f, TStringId &id)
{
	std::string	str;
	if(f.isReading())
	{
		f.serial(str);
		id= localMap(str);
	}
	else
	{
		str= localUnmap(id);
		f.serial(str);
	}
}
Example #29
0
// ***************************************************************************
void	CMaterialBase::CAnimatedTexture::serial(NLMISC::IStream &f)
{
    ITexture	*text= NULL;
    if(f.isReading())
    {
        f.serialPolyPtr(text);
        Texture= text;
    }
    else
    {
        text= Texture;
        f.serialPolyPtr(text);
    }
}
Example #30
0
//-----------------------------------------------------------------------------
void CAuraActivationDateVector::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	if (f.isReading())
	{
		f.serialCont(_AuraActivationDates);						
		_AuraUsers.resize(_AuraActivationDates.size(), NLMISC::CEntityId::Unknown);
		cleanVector();
	}
	else
	{
		cleanVector();
		f.serialCont(_AuraActivationDates);
	}
}