static void doNodeUpdate(Net_Node* node, BitStream& bs, Net_ConnID cid) { size_t i = 0; for(NetNodeIntern::ReplicationSetup::iterator j = node->intern->replicationSetup.begin(); j != node->intern->replicationSetup.end(); ++j, ++i) { if( /* skip mark */ !bs.getBool()) continue; Net_ReplicatorBasic* replicator = dynamic_cast<Net_ReplicatorBasic*>(j->first); if(replicator == NULL) { errors << "Replicator " << i << " in update of node " << node->intern->debugStr() << " is not a basic replicator" << endl; break; // nothing else we can do } bool store = true; if(node->intern->interceptor) { BitStream peekStream(bs); replicator->peekStream = &peekStream; store = node->intern->interceptor->inPreUpdateItem(node, cid, eNet_RoleAuthority, replicator); replicator->clearPeekData(); replicator->ptr = NULL; replicator->peekStream = NULL; } replicator->unpackData(&bs, store); } }
/*** int TCPSocket::peekStream(byte *rgbPeek, size_t cbPeekMax, size_t index) ** int TCPSocket::peekStream(byte *rgbPeek, size_t cbPeekMax) ** ** Synopsis: ** Gets an array of bytes from the socket buffer without removing the bytes from the socket. ** ** Parameters: ** rgbPeek A pointer to a buffer to receive the bytes. ** ** cbPeekMax The maximum size of rgbPeek ** ** index Zero based index of where in the socket buffer to start copying bytes from. ** ** pStatus A pointer to receive the status of the call, usually the connection status, or an index out of bounds error. ** ** Return Values: ** The actual number of bytes coped. 0 is returned if no bytes were copied or an error occured. ** ** Errors: ** Index out of bounds, or a connection error. ** ** Notes: ** ** This call is safe to make without checking the connection status. ** */ size_t TCPSocket::peekStream(byte *rgbPeek, size_t cbPeekMax) { return(peekStream(rgbPeek, cbPeekMax, 0)); }
/*** int TcpClient::peekStream(byte *rgbPeek, size_t cbPeekMax, size_t index) ** int TcpClient::peekStream(byte *rgbPeek, size_t cbPeekMax) ** ** Synopsis: ** Gets an array of bytes from the socket buffer without removing the bytes from the socket. ** ** Parameters: ** rgbPeek A pointer to a buffer to receive the bytes. ** ** cbPeekMax The maximum size of rgbPeek ** ** index Zero based index of where in the socket buffer to start copying bytes from. ** ** pStatus A pointer to receive the status of the call, usually the connection status, or an index out of bounds error. ** ** Return Values: ** The actual number of bytes coped. 0 is returned if no bytes were copied or an error occured. ** ** Errors: ** Index out of bounds, or a connection error. ** ** Notes: ** ** This call is safe to make without checking the connection status. ** */ size_t TcpClient::peekStream(byte *rgbPeek, size_t cbPeekMax) { return(peekStream(rgbPeek, cbPeekMax, 0)); }