From 371af9c241c3064d64e1109098aa5471e545d32c Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 11 Aug 2011 07:02:57 +0200 Subject: Notify other players of wielded item change --- src/client.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index 398b2602d..edce25381 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1549,6 +1549,47 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id) // get damage from falling on ground m_ignore_damage_timer = 3.0; } + else if(command == TOCLIENT_PLAYERITEM) + { + std::string datastring((char*)&data[2], datasize-2); + std::istringstream is(datastring, std::ios_base::binary); + + u16 count = readU16(is); + + for (u16 i = 0; i < count; ++i) { + u16 peer_id = readU16(is); + Player *player = m_env.getPlayer(peer_id); + + if (player == NULL) + { + dout_client<isLocal()) { + dout_client<inventory.getList("main"); + std::string itemstring(deSerializeString(is)); + if (itemstring.empty()) { + inv->deleteItem(0); + dout_client<changeItem(0, InventoryItem::deSerialize(iss)); + dout_client<getWieldItem()->serialize(dout_client); + dout_client<