Fix detach inventory serialisation (#8331)
parent
82c6363559
commit
ac86d04784
|
@ -895,8 +895,10 @@ void Client::handleCommand_DetachedInventory(NetworkPacket* pkt)
|
||||||
inv = inv_it->second;
|
inv = inv_it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string contents;
|
u16 ignore;
|
||||||
*pkt >> contents;
|
*pkt >> ignore; // this used to be the length of the following string, ignore it
|
||||||
|
|
||||||
|
std::string contents = pkt->getRemainingString();
|
||||||
std::istringstream is(contents, std::ios::binary);
|
std::istringstream is(contents, std::ios::binary);
|
||||||
inv->deSerialize(is);
|
inv->deSerialize(is);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2576,7 +2576,10 @@ void Server::sendDetachedInventory(const std::string &name, session_t peer_id)
|
||||||
// Serialization & NetworkPacket isn't a love story
|
// Serialization & NetworkPacket isn't a love story
|
||||||
std::ostringstream os(std::ios_base::binary);
|
std::ostringstream os(std::ios_base::binary);
|
||||||
inv_it->second->serialize(os);
|
inv_it->second->serialize(os);
|
||||||
pkt << os.str();
|
|
||||||
|
std::string os_str = os.str();
|
||||||
|
pkt << static_cast<u16>(os_str.size()); // HACK: to keep compatibility with 5.0.0 clients
|
||||||
|
pkt.putRawString(os_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (peer_id == PEER_ID_INEXISTENT)
|
if (peer_id == PEER_ID_INEXISTENT)
|
||||||
|
|
Loading…
Reference in New Issue