From fae3bcaeeb1972745e65556cb6377a7b4316cfed Mon Sep 17 00:00:00 2001 From: David Cernat Date: Thu, 6 Apr 2017 06:42:25 +0300 Subject: [PATCH] [Server] Send actor packets only to players in the same cell --- apps/openmw-mp/processors/world/ProcessorActorFrame.hpp | 6 +++++- apps/openmw-mp/processors/world/ProcessorActorList.hpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/openmw-mp/processors/world/ProcessorActorFrame.hpp b/apps/openmw-mp/processors/world/ProcessorActorFrame.hpp index 40acd03f0..38b693c7f 100644 --- a/apps/openmw-mp/processors/world/ProcessorActorFrame.hpp +++ b/apps/openmw-mp/processors/world/ProcessorActorFrame.hpp @@ -15,7 +15,11 @@ namespace mwmp void Do(WorldPacket &packet, Player &player, BaseEvent &event) override { - packet.Send(true); + // Send only to players who have the cell loaded + Cell *serverCell = CellController::get()->getCell(&event.cell); + + if (serverCell != nullptr) + serverCell->sendToLoaded(&packet, &event); Script::Call(player.getId(), event.cell.getDescription().c_str()); } diff --git a/apps/openmw-mp/processors/world/ProcessorActorList.hpp b/apps/openmw-mp/processors/world/ProcessorActorList.hpp index c2c6cb87c..e417c76b5 100644 --- a/apps/openmw-mp/processors/world/ProcessorActorList.hpp +++ b/apps/openmw-mp/processors/world/ProcessorActorList.hpp @@ -15,7 +15,11 @@ namespace mwmp void Do(WorldPacket &packet, Player &player, BaseEvent &event) override { - packet.Send(true); + // Send only to players who have the cell loaded + Cell *serverCell = CellController::get()->getCell(&event.cell); + + if (serverCell != nullptr) + serverCell->sendToLoaded(&packet, &event); Script::Call(player.getId(), event.cell.getDescription().c_str()); }