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


C++ CBlockMember::GetData方法代码示例

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


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

示例1: SaveCommand

int CSequence::SaveCommand( CBlock *block )
{
	unsigned char	flags;
	int				numMembers, bID, size;
	CBlockMember	*bm;

	ojk::SavedGameHelper saved_game(
		m_owner->GetInterface()->saved_game);

	//Save out the block ID
	bID = block->GetBlockID();

	saved_game.write_chunk<int32_t>(
		INT_ID('B', 'L', 'I', 'D'),
		bID);

	//Save out the block's flags
	flags = block->GetFlags();

	saved_game.write_chunk<uint8_t>(
		INT_ID('B', 'F', 'L', 'G'),
		flags);

	//Save out the number of members to read
	numMembers = block->GetNumMembers();

	saved_game.write_chunk<int32_t>(
		INT_ID('B', 'N', 'U', 'M'),
		numMembers);

	for ( int i = 0; i < numMembers; i++ )
	{
		bm = block->GetMember( i );

		//Save the block id
		bID = bm->GetID();

		saved_game.write_chunk<int32_t>(
			INT_ID('B', 'M', 'I', 'D'),
			bID);
		
		//Save out the data size
		size = bm->GetSize();

		saved_game.write_chunk<int32_t>(
			INT_ID('B', 'S', 'I', 'Z'),
			size);
		
		//Save out the raw data
        const uint8_t* raw_data = static_cast<const uint8_t*>(bm->GetData());

		saved_game.write_chunk(
			INT_ID('B', 'M', 'E', 'M'),
			raw_data,
			size);
	}

	return true;
}
开发者ID:Avygeil,项目名称:NewJK,代码行数:59,代码来源:Sequence.cpp

示例2: SaveCommand

int CSequence::SaveCommand( CBlock *block )
{
	CIcarus *pIcarus = (CIcarus *)IIcarusInterface::GetIcarus();

	unsigned char	flags;
	int				numMembers, bID, size;
	CBlockMember	*bm;

	// Data saved here (IBLK):
	//	Block ID.
	//	Block Flags.
	//	Number of Block Members.
	//	Block Members:
	//				- Block Member ID.
	//				- Block Data Size.
	//				- Block (Raw) Data.

	//Save out the block ID
	bID = block->GetBlockID();
	pIcarus->BufferWrite( &bID, sizeof ( bID ) );

	//Save out the block's flags
	flags = block->GetFlags();
	pIcarus->BufferWrite( &flags, sizeof ( flags ) );

	//Save out the number of members to read
	numMembers = block->GetNumMembers();
	pIcarus->BufferWrite( &numMembers, sizeof ( numMembers ) );

	for ( int i = 0; i < numMembers; i++ )
	{
		bm = block->GetMember( i );

		//Save the block id
		bID = bm->GetID();
		pIcarus->BufferWrite( &bID, sizeof ( bID ) );

		//Save out the data size
		size = bm->GetSize();
		pIcarus->BufferWrite( &size, sizeof ( size ) );

		//Save out the raw data
		pIcarus->BufferWrite( bm->GetData(), size );
	}

	return true;
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:47,代码来源:Sequence.cpp

示例3: SaveCommand

int CSequence::SaveCommand( CBlock *block )
{
	unsigned char	flags;
	int				numMembers, bID, size;
	CBlockMember	*bm;
	
	//Save out the block ID
	bID = block->GetBlockID();
	(m_owner->GetInterface())->I_WriteSaveData( INT_ID('B','L','I','D'), &bID, sizeof ( bID ) );

	//Save out the block's flags
	flags = block->GetFlags();
	(m_owner->GetInterface())->I_WriteSaveData( INT_ID('B','F','L','G'), &flags, sizeof ( flags ) );

	//Save out the number of members to read
	numMembers = block->GetNumMembers();
	(m_owner->GetInterface())->I_WriteSaveData( INT_ID('B','N','U','M'), &numMembers, sizeof ( numMembers ) );

	for ( int i = 0; i < numMembers; i++ )
	{
		bm = block->GetMember( i );

		//Save the block id
		bID = bm->GetID();
		(m_owner->GetInterface())->I_WriteSaveData( INT_ID('B','M','I','D'), &bID, sizeof ( bID ) );
		
		//Save out the data size
		size = bm->GetSize();
		(m_owner->GetInterface())->I_WriteSaveData( INT_ID('B','S','I','Z'), &size, sizeof( size ) );
		
		//Save out the raw data
		(m_owner->GetInterface())->I_WriteSaveData( INT_ID('B','M','E','M'), bm->GetData(), size );
	}

	return true;
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:36,代码来源:Sequence.cpp


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