示例#1
0
void MOUL::NetMsgSDLState::read(DS::Stream* stream)
{
    NetMsgObject::read(stream);

    NetMsgStream blobStream;
    blobStream.read(stream);
    m_compression = blobStream.m_compression;
    uint8_t* sdl = new uint8_t[blobStream.m_stream.size()];
    memcpy(sdl, blobStream.m_stream.buffer(), blobStream.m_stream.size());
    m_sdlBlob = DS::Blob::Steal(sdl, blobStream.m_stream.size());

    m_isInitial = stream->read<bool>();
    m_persistOnServer = stream->read<bool>();
    m_isAvatar = stream->read<bool>();
}
示例#2
0
void MOUL::NetMsgSharedState::read(DS::Stream* stream)
{
    NetMsgObject::read(stream);

    NetMsgStream msgStream;
    msgStream.read(stream);
    m_compression = msgStream.m_compression;

    // Read the state
    uint16_t nameLen = msgStream.m_stream.read<uint16_t>();
    m_stateName = msgStream.m_stream.readString(nameLen, DS::e_StringUTF8);
    m_vars.resize(msgStream.m_stream.read<uint32_t>());
    m_serverMayDelete = msgStream.m_stream.readBool();

    for (size_t i=0; i<m_vars.size(); ++i)
        m_vars[i].read(&msgStream.m_stream);
    DS_DASSERT(msgStream.m_stream.atEof());

    m_lockRequest = stream->read<uint8_t>();
}