本文整理汇总了C++中raknet::BitStream::ResetReadPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ BitStream::ResetReadPointer方法的具体用法?C++ BitStream::ResetReadPointer怎么用?C++ BitStream::ResetReadPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类raknet::BitStream
的用法示例。
在下文中一共展示了BitStream::ResetReadPointer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bsIn
PluginReceiveResult RPC4::OnReceive(Packet *packet)
{
if (packet->data[0]==ID_RPC_PLUGIN)
{
RakNet::BitStream bsIn(packet->data,packet->length,false);
bsIn.IgnoreBytes(2);
if (packet->data[1]==ID_RPC4_CALL)
{
RakNet::RakString functionName;
bsIn.ReadCompressed(functionName);
bool isBlocking;
bsIn.Read(isBlocking);
if (isBlocking==false)
{
DataStructures::HashIndex skhi = registeredNonblockingFunctions.GetIndexOf(functionName.C_String());
if (skhi.IsInvalid())
{
RakNet::BitStream bsOut;
bsOut.Write((unsigned char) ID_RPC_REMOTE_ERROR);
bsOut.Write((unsigned char) RPC_ERROR_FUNCTION_NOT_REGISTERED);
bsOut.Write(functionName.C_String(),(unsigned int) functionName.GetLength()+1);
SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet->systemAddress,false);
return RR_STOP_PROCESSING_AND_DEALLOCATE;
}
void ( *fp ) ( RakNet::BitStream *, Packet * );
fp = registeredNonblockingFunctions.ItemAtIndex(skhi);
bsIn.AlignReadToByteBoundary();
fp(&bsIn,packet);
}
else
{
DataStructures::HashIndex skhi = registeredBlockingFunctions.GetIndexOf(functionName.C_String());
if (skhi.IsInvalid())
{
RakNet::BitStream bsOut;
bsOut.Write((unsigned char) ID_RPC_REMOTE_ERROR);
bsOut.Write((unsigned char) RPC_ERROR_FUNCTION_NOT_REGISTERED);
bsOut.Write(functionName.C_String(),(unsigned int) functionName.GetLength()+1);
SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet->systemAddress,false);
return RR_STOP_PROCESSING_AND_DEALLOCATE;
}
void ( *fp ) ( RakNet::BitStream *, RakNet::BitStream *, Packet * );
fp = registeredBlockingFunctions.ItemAtIndex(skhi);
RakNet::BitStream returnData;
bsIn.AlignReadToByteBoundary();
fp(&bsIn, &returnData, packet);
RakNet::BitStream out;
out.Write((MessageID) ID_RPC_PLUGIN);
out.Write((MessageID) ID_RPC4_RETURN);
returnData.ResetReadPointer();
out.AlignWriteToByteBoundary();
out.Write(returnData);
SendUnified(&out,IMMEDIATE_PRIORITY,RELIABLE_ORDERED,0,packet->systemAddress,false);
}
}
else
{
RakAssert(packet->data[1]==ID_RPC4_RETURN);
blockingReturnValue.Reset();
blockingReturnValue.Read(bsIn);
gotBlockingReturnValue=true;
}
return RR_STOP_PROCESSING_AND_DEALLOCATE;
}
bool objectExists;
unsigned int index, index2;
index = localCallbacks.GetIndexFromKey(packet->data[0],&objectExists);
if (objectExists)
{
LocalCallback *lc;
lc = localCallbacks[index];
for (index2=0; index2 < lc->functions.Size(); index2++)
{
RakNet::BitStream bsIn(packet->data, packet->length, false);
DataStructures::HashIndex skhi = registeredNonblockingFunctions.GetIndexOf(lc->functions[index2].C_String());
if (skhi.IsInvalid()==false)
{
void ( *fp ) ( RakNet::BitStream *, Packet * );
fp = registeredNonblockingFunctions.ItemAtIndex(skhi);
bsIn.AlignReadToByteBoundary();
fp(&bsIn,packet);
}
}
}
return RR_CONTINUE_PROCESSING;
}