diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2019-03-01 20:16:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-01 20:16:11 +0100 |
commit | 170dd409cbf1856600ee5089a95c096dd668b75e (patch) | |
tree | dd18026fbfe1e9c76f9081864174266109809996 /src/network | |
parent | 111f1dc9c5f336f5b4f12c15940dc4cc2cbe7f82 (diff) | |
download | minetest-170dd409cbf1856600ee5089a95c096dd668b75e.tar.gz minetest-170dd409cbf1856600ee5089a95c096dd668b75e.tar.bz2 minetest-170dd409cbf1856600ee5089a95c096dd668b75e.zip |
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
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/clientpackethandler.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
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); } |