From 170dd409cbf1856600ee5089a95c096dd668b75e Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Fri, 1 Mar 2019 20:16:11 +0100 Subject: Fix particle spawners not visible since CSM spawner implementation (#8289) * Drop the ID mapper, use a big u64 instead. This will permit to resync server ids properly with the manager code * Modernize some code parts (std::unordered_map, auto) * generate id on client part on U32_MAX + 1 ids, lower are for server ids --- src/network/clientpackethandler.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'src/network') diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 2d02d0755..3e50173a6 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -1007,10 +1007,7 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt) object_collision = readU8(is); } catch (...) {} - u32 client_id = m_particle_manager.getSpawnerId(); - m_particles_server_to_client[server_id] = client_id; - - ClientEvent *event = new ClientEvent(); + auto event = new ClientEvent(); event->type = CE_ADD_PARTICLESPAWNER; event->add_particlespawner.amount = amount; event->add_particlespawner.spawntime = spawntime; @@ -1030,7 +1027,7 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt) event->add_particlespawner.attached_id = attached_id; event->add_particlespawner.vertical = vertical; event->add_particlespawner.texture = new std::string(texture); - event->add_particlespawner.id = client_id; + event->add_particlespawner.id = server_id; event->add_particlespawner.animation = animation; event->add_particlespawner.glow = glow; @@ -1043,16 +1040,9 @@ void Client::handleCommand_DeleteParticleSpawner(NetworkPacket* pkt) u32 server_id; *pkt >> server_id; - u32 client_id; - auto i = m_particles_server_to_client.find(server_id); - if (i != m_particles_server_to_client.end()) - client_id = i->second; - else - return; - ClientEvent *event = new ClientEvent(); event->type = CE_DELETE_PARTICLESPAWNER; - event->delete_particlespawner.id = client_id; + event->delete_particlespawner.id = server_id; m_client_event_queue.push(event); } -- cgit v1.2.3