From 1e2517698d6a6c5a5fb1057f9c4f33e98bc0ddb1 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 29 Dec 2017 06:17:45 +0200 Subject: [PATCH] [Server] Send player speech and animation packets only to nearby players --- apps/openmw-mp/Script/Functions/Dialogue.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Dialogue.cpp b/apps/openmw-mp/Script/Functions/Dialogue.cpp index eacf21dcb..fe0380f46 100644 --- a/apps/openmw-mp/Script/Functions/Dialogue.cpp +++ b/apps/openmw-mp/Script/Functions/Dialogue.cpp @@ -64,9 +64,10 @@ void DialogueFunctions::PlayAnimation(unsigned short pid, const char* groupname, player->animation.count = count; player->animation.persist = persist; - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ANIM_PLAY)->setPlayer(player); - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ANIM_PLAY)->Send(false); - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ANIM_PLAY)->Send(true); + mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ANIM_PLAY); + packet->setPlayer(player); + packet->Send(false); + player->sendToLoaded(packet); } void DialogueFunctions::PlaySpeech(unsigned short pid, const char* sound) noexcept @@ -76,7 +77,8 @@ void DialogueFunctions::PlaySpeech(unsigned short pid, const char* sound) noexce player->sound = sound; - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPEECH)->setPlayer(player); - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPEECH)->Send(false); - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPEECH)->Send(true); + mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPEECH); + packet->setPlayer(player); + packet->Send(false); + player->sendToLoaded(packet); }