当前位置: 首页>>代码示例>>C++>>正文


C++ IStream::isReading方法代码示例

本文整理汇总了C++中nlmisc::IStream::isReading方法的典型用法代码示例。如果您正苦于以下问题:C++ IStream::isReading方法的具体用法?C++ IStream::isReading怎么用?C++ IStream::isReading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nlmisc::IStream的用法示例。


在下文中一共展示了IStream::isReading方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: serial

void CVisualConfig::serial(NLMISC::IStream & f) throw (NLMISC::EStream) {
    if (!f.isReading()) {
        throw "This is only for reading";
    }

    uint8 ver;
    f.serial(ver);
    nldebug("CVisualConfig::serial version %d", ver);

    if (ver < 2) {
        pktFormat = (EPacketFormat) ver;
    } else {
        f.serialShortEnum(pktFormat);
    }

    f.serialShortEnum(Race);

    if (ver >= 2) {
        f.serial(Age);
        if (Age > 2) {
            Age = 2;
        }
    } else {
        Age = 0;
    }

    if (pktFormat == PKT_SHORT) {
        nldebug(">> short packet");
        vpa.serial(f);
        vpb.serial(f);
        vpc.serial(f);
        nlinfo("1");
    } else {
        nldebug(">> long packet");
        // they say bitfields are compiler and platform specific - this is mainly for php
        uint32 b;
        f.serial(b);
        vpa.PropertySubData.Sex = b;
        f.serial(b);
        vpa.PropertySubData.JacketModel = b;
        f.serial(b);
        vpa.PropertySubData.JacketColor = b;
        f.serial(b);
        vpa.PropertySubData.TrouserModel = b;
        f.serial(b);
        vpa.PropertySubData.TrouserColor = b;
        f.serial(b);
        vpa.PropertySubData.WeaponRightHand = b;
        f.serial(b);
        vpa.PropertySubData.WeaponLeftHand = b;
        f.serial(b);
        vpa.PropertySubData.ArmModel = b;
        f.serial(b);
        vpa.PropertySubData.ArmColor = b;
        f.serial(b);
        vpa.PropertySubData.HatModel = b;
        f.serial(b);
        vpa.PropertySubData.HatColor = b;

        f.serial(b);
        vpb.PropertySubData.Name = b;
        f.serial(b);
        vpb.PropertySubData.HandsModel = b;
        f.serial(b);
        vpb.PropertySubData.HandsColor = b;
        f.serial(b);
        vpb.PropertySubData.FeetModel = b;
        f.serial(b);
        vpb.PropertySubData.FeetColor = b;
        f.serial(b);
        vpb.PropertySubData.RTrail = b;
        f.serial(b);
        vpb.PropertySubData.LTrail = b;

        f.serial(b);
        vpc.PropertySubData.MorphTarget1 = b;
        f.serial(b);
        vpc.PropertySubData.MorphTarget2 = b;
        f.serial(b);
        vpc.PropertySubData.MorphTarget3 = b;
        f.serial(b);
        vpc.PropertySubData.MorphTarget4 = b;
        f.serial(b);
        vpc.PropertySubData.MorphTarget5 = b;
        f.serial(b);
        vpc.PropertySubData.MorphTarget6 = b;
        f.serial(b);
        vpc.PropertySubData.MorphTarget7 = b;
        f.serial(b);
        vpc.PropertySubData.MorphTarget8 = b;
        f.serial(b);
        vpc.PropertySubData.EyesColor = b;
        f.serial(b);
        vpc.PropertySubData.Tattoo = b;
        f.serial(b);
        vpc.PropertySubData.CharacterHeight = b;
        f.serial(b);
        vpc.PropertySubData.TorsoWidth = b;
        f.serial(b);
        vpc.PropertySubData.ArmsWidth = b;
//.........这里部分代码省略.........
开发者ID:nimetu,项目名称:rrs_server,代码行数:101,代码来源:visual_config.cpp

示例2: operand

// ***************************************************************************
void		CMaterial::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
	 * ***********************************************/

	/*
	Version 9:
		- Added support for third operand (for Mad operator)
	Version 8:
		- Serial _TexCoordGenMode
	Version 7:
		- Lightmap color and Mulx2
	Version 6:
		- Texture matrix animation
	Version 5:
		- AlphaTest threshold
	Version 4:
		- Texture Addressing modes
	Version 3:
		- LightMaps.
	Version 2:
		- Shininess.
	Version 1:
		- texture environement.
	Version 0:
		- base version.
	*/

	sint	ver= f.serialVersion(9);
	// For the version <=1:
	nlassert(IDRV_MAT_MAXTEXTURES==4);

	f.serialEnum(_ShaderType);
	f.serial(_Flags);
	f.serialEnum(_SrcBlend);
	f.serialEnum(_DstBlend);
	f.serialEnum(_ZFunction);
	f.serial(_ZBias);
	f.serial(_Color);
	f.serial(_Emissive, _Ambient, _Diffuse, _Specular);
	if(ver>=2)
	{
		f.serial(_Shininess);
	}
	if(ver>=5)
	{
		f.serial(_AlphaTestThreshold);
	}
	if(ver>=8)
	{
		f.serial(_TexCoordGenMode);
	}
	else
		_TexCoordGenMode = 0;


	for(uint32 i=0;i<IDRV_MAT_MAXTEXTURES;i++)
	{
		// Serial texture descriptor.
		_Textures[i].serialPolyPtr(f);

		// Read texture environnement, or setup them.
		if(ver>=1)
		{
			_TexEnvs[i].serial(f, ver >= 9 ? 1 : 0);
		}
		else
		{
			// Else setup as default behavior, like before...
			if(f.isReading())
				_TexEnvs[i].setDefault();
		}
	}

	if(ver>=3)
	{
		if(ver>=7)
		{
			uint32 n;
			if (f.isReading())
			{
				f.serial(n);
				_LightMaps.resize(n);
			}
			else
			{
				n = (uint32)_LightMaps.size();
				f.serial(n);
			}
			for (uint32 i = 0; i < n; ++i)
				_LightMaps[i].serial2(f);
			f.serial(_LightMapsMulx2);
		}
		else
		{
			f.serialCont(_LightMaps);
		}
//.........这里部分代码省略.........
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:101,代码来源:material.cpp

示例3: serial

// ***************************************************************************
void CSheetManagerEntry::serial (NLMISC::IStream &s)
{
	if (s.isReading())
	{
//		if (EntitySheet != NULL)
//			delete EntitySheet;

		CEntitySheet::TType type = CEntitySheet::TypeCount;
		s.serialEnum(type);

		switch(type)
		{
			case CEntitySheet::FAUNA:
			{
				EntitySheet = new CCharacterSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::FLORA:
			{
				EntitySheet = new CFloraSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::CHAR:
			{
				EntitySheet = new CPlayerSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::FX:
			{
				EntitySheet = new CFXSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::BUILDING:
			{
				EntitySheet = new CBuildingSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::ITEM:
			{
				EntitySheet = new CItemSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::PLANT:
			{
				EntitySheet = new CPlantSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::PACT:
			{
				EntitySheet = new CPactSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::MISSION:
			{
				EntitySheet = new CMissionSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::MISSION_ICON:
			{
				EntitySheet = new CMissionIconSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::RACE_STATS:
			{
				EntitySheet = new CRaceStatsSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::LIGHT_CYCLE:
			{
				EntitySheet = new CLightCycleSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::WEATHER_SETUP:
			{
				EntitySheet = new CWeatherSetupSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::CONTINENT:
			{
				EntitySheet = new CContinentSheet;
				initSheet(EntitySheet, s, type);
			}
			break;
			case CEntitySheet::WORLD:
			{
				EntitySheet = new CWorldSheet;
//.........这里部分代码省略.........
开发者ID:mixxit,项目名称:solinia,代码行数:101,代码来源:sheet_manager.cpp

示例4: write

// ***************************************************************************
void CInterfaceConfig::CDesktopImage::serial(NLMISC::IStream &s)
{
	if (s.isReading()) read(s);
	else write(s);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:6,代码来源:interface_config.cpp

示例5: if

// ***************************************************************************
void CInterfaceConfig::SCont::serial(NLMISC::IStream &f)
{
	// version 10 : added minW & maxW
	// version 9 : Backuped position & touchFlag
	// version 8 : ContainerMode
	// version 7 : RolloverAlphaContainer and RolloverAlphaContent separated
	// version 6 : added 'pop_max_h' value
	// version 5 : added 'active_savable' flag
	// version 4 : added 'movable' flag
	// version 3 : added 'locked' flag
	// version 2 : added 'useGlobalAlpha' flag
	// version 1 : added alpha's & popup coords & size
	// version 0 : base version
	sint ver = f.serialVersion(10);
	if (ver >= 10)
	{
		f.serial(MinW);
		f.serial(MaxW);
	}
	if (ver >= 8)
	{
		if (f.isReading())
		{
			f.serial(Id);
			Id = "ui:interface:"+Id;
		}
		else
		{
			std::string shortId;
			std::string startString;
			if (Id.size() >= 13)
			{
				startString = Id.substr(0, 13);
			}
			if (startString == "ui:interface:")
			{
				shortId = Id.substr(13,Id.size());
			}
			else
			{
				shortId = Id;
			}
			f.serial(shortId);
		}
		f.serial(ContainerMode);
		if (ContainerMode == 0)
		{
			f.serial(Popuped);
			f.serial(Opened);
			f.serial(X);
			f.serial(Y);
			f.serial(W);
			f.serial(H);
			f.serial(Active);
			f.serial(ScrollPos);
			f.serial(BgAlpha);
			f.serial(ContentAlpha);
			f.serial(RolloverAlphaContent);
			f.serial(PopupX);
			f.serial(PopupY);
			f.serial(PopupW);
			f.serial(PopupH);
			f.serial(UseGlobalAlpha);
			f.serial(Locked);
			f.serial(Movable);
			f.serial(ActiveSavable);
			f.serial(PopupMaxH);
			f.serial(RolloverAlphaContainer);
			if (ver >= 9)
			{
				f.serial(BackupedPositionValid);
				if (BackupedPositionValid)
				{
					f.serial(BackupX);
					f.serial(BackupY);
				}
				f.serial(TouchFlag);
			}
		}
		else if (ContainerMode == 1)
		{
			f.serial(Opened);
			f.serial(Active);
			f.serial(ActiveSavable);
		}
	}
	else
	{
		ContainerMode = 0;
		f.serial(Id);
		f.serial(Popuped);
		f.serial(Opened);
		f.serial(X);
		f.serial(Y);
		f.serial(W);
		f.serial(H);
		f.serial(Active);
		f.serial(ScrollPos);
		if (ver >= 1)
//.........这里部分代码省略.........
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:101,代码来源:interface_config.cpp

示例6: serial

///==================================================================================================================
void CPSRibbon::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
	NL_PS_FUNC(CPSRibbon_serial)
	// Version 3 : - added brace mode
	//             - added orientation enum
	sint ver = f.serialVersion(3);
	if (ver == 1)
	{
		nlassert(f.isReading());

		/// we had CPSParticle::serial(f), but this is not the base class anymore, so we emulate this...
		/// version 2 : auto-lod saved
		sint ver2 = f.serialVersion(2);

		// here is CPSLocatedBindable::serial(f)
		sint ver3 = f.serialVersion(4);
		f.serialPtr(_Owner);
		if (ver3 > 1) f.serialEnum(_LOD);
		if (ver3 > 2) f.serial(_Name);
		if (ver3 > 3)
		{
			if (f.isReading())
			{
				uint32 id;
				f.serial(id);
				setExternID(id);
			}
			else
			{
				f.serial(_ExternID);
			}
		}

		if (ver2 >= 2)
		{
			bool bDisableAutoLOD;
			f.serial(bDisableAutoLOD);
			disableAutoLOD(bDisableAutoLOD);
		}

		uint32 tailNbSegs;
		bool   colorFading;
		bool   systemBasisEnabled;
		bool   drEnabled; // dying ribbons, not supported in this version

		CPSColoredParticle::serialColorScheme(f);
		CPSSizedParticle::serialSizeScheme(f);

		// we dont use the 2d angle anymore...serial a dummy one
		{
			 CDummy2DAngle _Dummy2DAngle;
			_Dummy2DAngle.serialAngle2DScheme(f);
		}

		f.serial(colorFading, systemBasisEnabled);
		serialMaterial(f);

		f.serial(drEnabled);
		f.serial(tailNbSegs);
		ITexture *tex = NULL;
		f.serialPolyPtr(tex);
		_Tex = tex;
		if (_Tex != NULL)
		{
			f.serial(_UFactor, _VFactor) ;
		}

		// shape serialization
		f.serialCont(_Shape);


		_NbSegs = tailNbSegs >> 1;
		if (_NbSegs < 1) _NbSegs = 2;
		setInterpolationMode(Linear);

		nlassert(_Owner);
		resize(_Owner->getMaxSize());
		initDateVect();
		resetFromOwner();
	}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:81,代码来源:ps_ribbon.cpp

示例7: serial

//============================================
void CWaterShape::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
	 * ***********************************************/

	// version 4 : added scene water env map
	// version 3 : added '_Splashenabled' flag
	sint ver = f.serialVersion(4);
	// serial 'shape'
	f.serial(_Poly);
	// serial heightMap identifier
	f.serial(_WaterPoolID);
	//serial maps
	ITexture *map = NULL;
	if (f.isReading())
	{
		f.serialPolyPtr(map); _EnvMap[0] = map;
		f.serialPolyPtr(map); _EnvMap[1] = map;
		f.serialPolyPtr(map); _BumpMap[0] = map;
		f.serialPolyPtr(map); _BumpMap[1] = map;
		f.serialPolyPtr(map); _ColorMap = map;
		computeBBox();
	}
	else
	{
		map = _EnvMap[0]; f.serialPolyPtr(map);
		map = _EnvMap[1]; f.serialPolyPtr(map);
		map = _BumpMap[0]; f.serialPolyPtr(map);
		map = _BumpMap[1]; f.serialPolyPtr(map);
		map = _ColorMap; f.serialPolyPtr(map);
	}

	f.serial(_HeightMapScale[0], _HeightMapScale[1],
			 _HeightMapSpeed[0], _HeightMapSpeed[1]);

	f.serial(_ColorMapMatColumn0, _ColorMapMatColumn1, _ColorMapMatPos);

	// serial default tracks
	f.serial(_DefaultPos);
	f.serial(_DefaultScale);
	f.serial(_DefaultRotQuat);

	f.serial(_TransitionRatio);

	f.serial(_WaveHeightFactor);

	if (ver >= 1)
		f.serial (_ComputeLightmap);

	if (ver >= 2)
		f.serial (_DistMax);

	if (ver >= 3)
		f.serial(_SplashEnabled);

	if (ver >= 4)
	{
		f.serial(_UsesSceneWaterEnvMap[0], _UsesSceneWaterEnvMap[1]);
	}

	// tmp
	/*
	if (f.isReading())
	{
		_UsesSceneWaterEnvMap[0] = true;
		_UsesSceneWaterEnvMap[1] = true;
	}
	*/
}
开发者ID:mixxit,项目名称:solinia,代码行数:72,代码来源:water_shape.cpp


注:本文中的nlmisc::IStream::isReading方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。