Sources/CryGame C++/Solution1/CryGame/XDemoMgr.cpp
//////////////////////////////////////////////////////////////////////////
// Reads a demo-chunk from disk.

Reads a demo-chunk from disk.
Reads a demo - chunk from disk .
bool CXDemoMgr::ReadChunk(CStream &stm, float &fTimestamp, Vec3d &angles)
{
	unsigned int nStreamSizeInBytes;
	unsigned int nStreamSizeInBits;
	if(m_pFile==NULL)
		return false;
	stm.Reset();
	if(fread(&fTimestamp, sizeof(fTimestamp),1,m_pFile)!=1)
		return false;
	if(fread(&nStreamSizeInBits,sizeof(nStreamSizeInBits),1,m_pFile)!=1)
		return false;
	nStreamSizeInBytes = BITS2BYTES(nStreamSizeInBits);
	#ifdef _DEBUG
	if(nStreamSizeInBits>stm.GetAllocatedSize())
		CryError( "<CryGame> (CXDemoMgr::ReadChunk) Invalid stream size" );	
	#endif
	stm.SetSize(nStreamSizeInBits);
	if(fread(stm.GetPtr(), nStreamSizeInBytes, 1, m_pFile)!=1)
		return false;
	if(fread(&angles, sizeof(Vec3d), 1, m_pFile)!=1)
		return false;
	return true;
}
bool CXDemoMgr :: ReadChunk ( CStream & stm , float & fTimestamp , Vec3d & angles ) { unsigned int nStreamSizeInBytes ; unsigned int nStreamSizeInBits ; if ( m_pFile == NULL ) return false ; stm . Reset ( ) ; if ( fread ( & fTimestamp , sizeof ( fTimestamp ) , 1 , m_pFile ) != 1 ) return false ; if ( fread ( & nStreamSizeInBits , sizeof ( nStreamSizeInBits ) , 1 , m_pFile ) != 1 ) return false ; nStreamSizeInBytes = BITS2BYTES ( nStreamSizeInBits ) ; #ifdef _DEBUG if ( nStreamSizeInBits > stm . GetAllocatedSize ( ) ) CryError ( " " ) ; #endif stm . SetSize ( nStreamSizeInBits ) ; if ( fread ( stm . GetPtr ( ) , nStreamSizeInBytes , 1 , m_pFile ) != 1 ) return false ; if ( fread ( & angles , sizeof ( Vec3d ) , 1 , m_pFile ) != 1 ) return false ; return true ; }
Reads a demo-chunk from disk.
Reads a demo - chunk from disk .