[Server] Send actor packets only to players in the same cell

This commit is contained in:
David Cernat 2017-04-06 06:42:25 +03:00
parent 89ed318d3c
commit fae3bcaeeb
2 changed files with 10 additions and 2 deletions

View file

@ -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<Script::CallbackIdentity("OnActorFrame")>(player.getId(), event.cell.getDescription().c_str());
}

View file

@ -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<Script::CallbackIdentity("OnActorList")>(player.getId(), event.cell.getDescription().c_str());
}