本文整理汇总了C++中CAction::unpack方法的典型用法代码示例。如果您正苦于以下问题:C++ CAction::unpack方法的具体用法?C++ CAction::unpack怎么用?C++ CAction::unpack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAction
的用法示例。
在下文中一共展示了CAction::unpack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unpack
/* Unpack some actions from a bit stream. Set transmitTimestamp=true for server-->client,
* false for client-->server. If true, set the current gamecycle.
*/
void CActionFactory::unpack (NLMISC::CBitMemStream &message, std::vector <CAction *>& actions, NLMISC::TGameCycle /* currentCycle */ )
{
actions.clear ();
static int n = 0;
n++;
while ((sint32)message.length() * 8 - message.getPosInBit () >= 8)
{
TActionCode code;
bool shortcode;
message.serial (shortcode);
if (shortcode)
{
code = 0;
uint32 val;
message.serial (val, 2);
code = (TActionCode) val;
}
else
{
message.serial (code);
}
CAction *action = create (INVALID_SLOT, code);
//nlinfo ("m%d size: p:%d s:%d c:%d (actionsize: %d) slot:%hu", n, message.getPosInBit (), message.length() * 8, code, action->size(), (uint16)action->CLEntityId);
if (action == NULL)
{
nlwarning ("Unpacking an action with unknown code, skip it (%u)", code);
}
else
{
action->unpack (message);
actions.push_back (action);
}
}
}
示例2: create
/* Unpack an action from a bit stream.
*/
CAction *CActionFactory::unpack (NLMISC::CBitMemStream &message, NLMISC::TGameCycle /* currentCycle */ )
{
CAction *action = NULL;
if ((sint32)message.length() * 8 - message.getPosInBit () >= 8)
{
TActionCode code;
bool shortcode;
message.serial (shortcode);
if (shortcode)
{
code = 0;
uint32 val;
message.serial (val, 2);
code = (TActionCode) val;
}
else
{
message.serial (code);
}
action = create (INVALID_SLOT, (TActionCode)code);
if (action == NULL)
{
nlwarning ("Unpacking an action with unknown code, skip it (%u)", code);
}
else
{
action->unpack (message);
}
}
return action;
}