1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD can be unreliable, catch PacketError exception.

Also set the packet size at creation not when pushing rawString, no functional change
This commit is contained in:
Loic Blot 2015-04-05 11:37:53 +02:00
parent ed3ebd633d
commit 8804c47e59
2 changed files with 22 additions and 17 deletions

View file

@ -1897,7 +1897,7 @@ void Server::SendPlayerInventoryFormspec(u16 peer_id)
u32 Server::SendActiveObjectRemoveAdd(u16 peer_id, const std::string &datas)
{
NetworkPacket pkt(TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD, 0, peer_id);
NetworkPacket pkt(TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD, datas.size(), peer_id);
pkt.putRawString(datas.c_str(), datas.size());
Send(&pkt);
return pkt.getSize();
@ -1906,7 +1906,7 @@ u32 Server::SendActiveObjectRemoveAdd(u16 peer_id, const std::string &datas)
void Server::SendActiveObjectMessages(u16 peer_id, const std::string &datas, bool reliable)
{
NetworkPacket pkt(TOCLIENT_ACTIVE_OBJECT_MESSAGES,
0, peer_id);
datas.size(), peer_id);
pkt.putRawString(datas.c_str(), datas.size());