1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

added PlayerSAO and RemotePlayer, removed ServerRemotePlayer

This commit is contained in:
Kahrl 2012-03-19 03:04:16 +01:00 committed by Perttu Ahola
parent 072c265c30
commit f8c3743991
20 changed files with 833 additions and 810 deletions

View file

@ -1397,45 +1397,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
}
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)
{
infostream<<"Client: ignoring player item "
<< deSerializeString(is)
<< " for non-existing peer id " << peer_id
<< std::endl;
continue;
} else if (player->isLocal()) {
infostream<<"Client: ignoring player item "
<< deSerializeString(is)
<< " for local player" << std::endl;
continue;
} else {
InventoryList *inv = player->inventory.getList("main");
std::string itemstring(deSerializeString(is));
ItemStack item;
item.deSerialize(itemstring, m_itemdef);
inv->changeItem(0, item);
if(itemstring.empty())
{
infostream<<"Client: empty player item for peer "
<<peer_id<<std::endl;
}
else
{
infostream<<"Client: player item for peer "
<<peer_id<<": "<<itemstring<<std::endl;
}
}
}
infostream<<"Client: WARNING: Ignoring TOCLIENT_PLAYERITEM"<<std::endl;
}
else if(command == TOCLIENT_DEATHSCREEN)
{