本文整理汇总了C++中CBlockMember类的典型用法代码示例。如果您正苦于以下问题:C++ CBlockMember类的具体用法?C++ CBlockMember怎么用?C++ CBlockMember使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBlockMember类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetInteger
int CBlockStream::ReadBlock( CBlock *get )
{
CBlockMember *bMember;
int b_id, numMembers;
unsigned char flags;
if (!BlockAvailable())
return false;
b_id = GetInteger();
numMembers = GetInteger();
flags = (unsigned char) GetChar();
if (numMembers < 0)
return false;
get->Create( b_id );
get->SetFlags( flags );
while ( numMembers-- > 0)
{
bMember = new CBlockMember;
bMember->ReadMember( &m_stream, &m_streamPos );
get->AddMember( bMember );
}
return true;
}
示例2: LittleLong
int CBlockStream::ReadBlock( CBlock *get, CIcarus* icarus )
{
CBlockMember *bMember;
int b_id, numMembers;
unsigned char flags;
if (!BlockAvailable())
return false;
b_id = LittleLong(*(int *) (m_stream + m_streamPos));
m_streamPos += sizeof( b_id );
numMembers = LittleLong(*(int *) (m_stream + m_streamPos));
m_streamPos += sizeof( numMembers );
flags = *(unsigned char*) (m_stream + m_streamPos);
m_streamPos += sizeof( flags );
if (numMembers < 0)
return false;
get->Create( b_id );
get->SetFlags( flags );
while ( numMembers-- > 0)
{
bMember = new CBlockMember;
bMember->ReadMember( &m_stream, &m_streamPos, icarus );
get->AddMember( bMember );
}
return true;
}
示例3: 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;
}
示例4: Write
int CBlock::Write( int member_id, int member_data )
{
CBlockMember *bMember = new CBlockMember;
bMember->SetID( member_id );
bMember->WriteData( member_data );
bMember->SetSize( sizeof(member_data) );
AddMember( bMember );
return true;
}
示例5: Write
int CBlock::Write( int member_id, float member_data, CIcarus* icarus )
{
CBlockMember *bMember = new CBlockMember;
bMember->SetID( member_id );
bMember->WriteData( member_data, icarus );
bMember->SetSize( sizeof(member_data) );
AddMember( bMember );
return true;
}
示例6:
CBlockMember *CBlockMember::Duplicate( void )
{
CBlockMember *newblock = new CBlockMember;
if ( newblock == NULL )
return NULL;
newblock->SetData( m_data, m_size );
newblock->SetSize( m_size );
newblock->SetID( m_id );
return newblock;
}
示例7: 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;
}
示例8: sizeof
int CBlockStream::ReadBlock( CBlock *get, CIcarus* icarus )
{
CBlockMember *bMember;
int b_id, numMembers;
unsigned char flags;
if (!BlockAvailable())
return false;
b_id = *(int *) (m_stream + m_streamPos);
m_streamPos += sizeof( b_id );
numMembers = *(int *) (m_stream + m_streamPos);
m_streamPos += sizeof( numMembers );
flags = *(unsigned char*) (m_stream + m_streamPos);
m_streamPos += sizeof( flags );
if (numMembers < 0)
return false;
get->Create( b_id );
get->SetFlags( flags );
// Stream blocks are generally temporary as they
// are just used in an initial parsing phase...
#ifdef _XBOX
extern void Z_SetNewDeleteTemporary(bool bTemp);
Z_SetNewDeleteTemporary(true);
#endif
while ( numMembers-- > 0)
{
bMember = new CBlockMember;
bMember->ReadMember( &m_stream, &m_streamPos, icarus );
get->AddMember( bMember );
}
#ifdef _XBOX
Z_SetNewDeleteTemporary(false);
#endif
return true;
}
示例9: GetNumMembers
int CBlock::Free( CIcarus* icarus )
{
IGameInterface* game = icarus->GetGame();
int numMembers = GetNumMembers();
CBlockMember *bMember;
while ( numMembers-- )
{
bMember = GetMember( numMembers );
if (!bMember)
return false;
bMember->Free(game);
}
m_members.clear(); //List of all CBlockMembers owned by this list
return true;
}
示例10: WriteBlock
int CBlockStream::WriteBlock( CBlock *block )
{
CBlockMember *bMember;
int id = block->GetBlockID();
int numMembers = block->GetNumMembers();
unsigned char flags = block->GetFlags();
fwrite ( &id, sizeof(id), 1, m_fileHandle );
fwrite ( &numMembers, sizeof(numMembers), 1, m_fileHandle );
fwrite ( &flags, sizeof( flags ), 1, m_fileHandle );
for ( int i = 0; i < numMembers; i++ )
{
bMember = block->GetMember( i );
bMember->WriteMember( m_fileHandle );
}
block->Free();
return true;
}
示例11: 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;
}