From 790c0325d52ae120e4136c19edd386817dd280e9 Mon Sep 17 00:00:00 2001 From: 1F616EMO Date: Thu, 30 Jan 2025 07:49:54 +0800 Subject: [PATCH 1/2] Fix sounds playing for objects not sent to the client This PR fixes sounds playing for object not sent to the client. --- rebuild | 5 +++++ src/network/clientpackethandler.cpp | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100755 rebuild diff --git a/rebuild b/rebuild new file mode 100755 index 0000000000000..93297b9119110 --- /dev/null +++ b/rebuild @@ -0,0 +1,5 @@ +#!/bin/bash +touch src/version.cpp +git update-index --refresh +cmake -B build -DRUN_IN_PLACE=TRUE -DUSE_SDL2=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja #-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" +cmake --build build --parallel $(($(nproc) + 1)) diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 1024988bdceea..2f4d6d8bf5768 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -846,13 +846,12 @@ void Client::handleCommand_PlaySound(NetworkPacket* pkt) break; case SoundLocation::Object: { ClientActiveObject *cao = m_env.getActiveObject(object_id); - v3f vel(0.0f); if (cao) { pos = cao->getPosition() * (1.0f/BS); - vel = cao->getVelocity() * (1.0f/BS); + v3f vel = cao->getVelocity() * (1.0f/BS); + m_sound->playSoundAt(client_id, spec, pos, vel); + break; } - m_sound->playSoundAt(client_id, spec, pos, vel); - break; } default: // Unknown SoundLocation, instantly remove sound From 15e3389c6f38b07d6d94610484cb8758c110f4fd Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 8 Feb 2025 15:26:58 +0100 Subject: [PATCH 2/2] fix --- rebuild | 5 ----- src/network/clientpackethandler.cpp | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100755 rebuild diff --git a/rebuild b/rebuild deleted file mode 100755 index 93297b9119110..0000000000000 --- a/rebuild +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -touch src/version.cpp -git update-index --refresh -cmake -B build -DRUN_IN_PLACE=TRUE -DUSE_SDL2=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja #-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -cmake --build build --parallel $(($(nproc) + 1)) diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 2f4d6d8bf5768..f2eab7e3f0220 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -852,6 +852,7 @@ void Client::handleCommand_PlaySound(NetworkPacket* pkt) m_sound->playSoundAt(client_id, spec, pos, vel); break; } + [[fallthrough]]; } default: // Unknown SoundLocation, instantly remove sound