diff options
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r-- | src/content_cao.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/content_cao.cpp b/src/content_cao.cpp index ce41c8312..c7d21d278 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -647,22 +647,36 @@ public: { infostream<<"GenericCAO: Got init data"<<std::endl; std::istringstream is(data, std::ios::binary); + int num_messages = 0; // version u8 version = readU8(is); // check version - if(version != 1){ + if(version == 1) // In PROTOCOL_VERSION 14 + { + m_name = deSerializeString(is); + m_is_player = readU8(is); + m_id = readS16(is); + m_position = readV3F1000(is); + m_yaw = readF1000(is); + m_hp = readS16(is); + num_messages = readU8(is); + } + else if(version == 0) // In PROTOCOL_VERSION 13 + { + m_name = deSerializeString(is); + m_is_player = readU8(is); + m_position = readV3F1000(is); + m_yaw = readF1000(is); + m_hp = readS16(is); + num_messages = readU8(is); + } + else + { errorstream<<"GenericCAO: Unsupported init data version" <<std::endl; return; } - m_name = deSerializeString(is); - m_is_player = readU8(is); - m_id = readS16(is); - m_position = readV3F1000(is); - m_yaw = readF1000(is); - m_hp = readS16(is); - - int num_messages = readU8(is); + for(int i=0; i<num_messages; i++){ std::string message = deSerializeLongString(is); processMessage(message); |