本文整理汇总了C++中nlmisc::CBitMemStream::serialAndLog2方法的典型用法代码示例。如果您正苦于以下问题:C++ CBitMemStream::serialAndLog2方法的具体用法?C++ CBitMemStream::serialAndLog2怎么用?C++ CBitMemStream::serialAndLog2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nlmisc::CBitMemStream
的用法示例。
在下文中一共展示了CBitMemStream::serialAndLog2方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Unknown
/*
* Push one change to the stream (permanent mode)
*/
void CCDBSynchronised::pushDeltaPermanent( NLMISC::CBitMemStream& s, CCDBStructNodeLeaf *node, uint32& bitsize )
{
TCDBDataIndex index = node->getDataIndex();
// Test if the property type is valid.
if ( node->type() > ICDBStructNode::UNKNOWN && node->type() < ICDBStructNode::Nb_Prop_Type )
{
// Serialize the Property Value according to the Property Type.
uint64 value;
value = (uint64)_DataContainer.getValue64( index ); // "delta from 0"
if ( node->type() == ICDBStructNode::TEXT )
{
s.serialAndLog2( value, 32 );
bitsize += 32;
if ( VerboseDatabase )
nldebug( "CDB: Pushing permanent value %"NL_I64"d (TEXT-32) for index %d prop %s", (sint64)value, index, node->buildTextId().toString().c_str() );
}
else
{
s.serialAndLog2( value, (uint)node->type() );
bitsize += (uint32)node->type();
if ( VerboseDatabase )
nldebug( "CDB: Pushing permanent value %"NL_I64"d (%u bits) for index %d prop %s", (sint64)value, (uint32)node->type(), index, node->buildTextId().toString().c_str() );
}
}
else
nlwarning("CCDBStructNodeLeaf::writeDeltaPermanent : Property Type Unknown ('%d') -> not serialized.", (uint)node->type());
}
示例2: pack
/* Pack an action to a bit stream. Set transmitTimestamp=true for server-->client,
* false for client-->server. If true, set the current gamecycle.
*/
void CActionFactory::pack (CAction *action, NLMISC::CBitMemStream &message, NLMISC::TGameCycle /* currentCycle */ )
{
//H_BEFORE(FactoryPack);
//sint32 val = message.getPosInBit ();
//
if (action->Code < 4)
{
// short code (0 1 2 3)
bool shortcode = true;
uint32 code = action->Code;
message.serialAndLog1 (shortcode);
message.serialAndLog2 (code, 2);
}
else
{
bool shortcode = false;
message.serialAndLog1 (shortcode);
message.serialAndLog1 (action->Code);
}
action->pack (message);
//H_AFTER(FactoryPack);
//OLIV: nlassertex (message.getPosInBit () - val == (sint32)CActionFactory::getInstance()->size (action), ("CActionFactory::pack () : action %d packed %u bits, should be %u, size() is wrong", action->Code, message.getPosInBit () - val, CActionFactory::getInstance()->size (action)));
// nlinfo ("ac:%p pack one action in message %d %hu %u %d", action, action->Code, (uint16)(action->CLEntityId), val, message.getPosInBit()-val);
}
示例3:
/*
* Write the id to a bit stream for server-client comms, and return the size of data written
*/
inline sint ICDBStructNode::CBinId::writeToBitMemStream( NLMISC::CBitMemStream& f ) const
{
sint bitsize = 0;
for ( uint i=0; i<Ids.size(); i++ )
{
uint32& nodeIndex = const_cast<uint32&>(Ids[i].first);
f.serialAndLog2( nodeIndex, Ids[i].second );
bitsize += Ids[i].second;
}
return bitsize;
}