forked from mirror/openmw-tes3mp
Add a CellRef to WorldEvent
This commit is contained in:
parent
b2845cd17c
commit
ac666edebd
5 changed files with 23 additions and 1 deletions
|
@ -368,6 +368,9 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
|
||||||
if (!player->isHandshaked() || player->LoadedState() != Player::POSTLOADED)
|
if (!player->isHandshaked() || player->LoadedState() != Player::POSTLOADED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
WorldPacket *myPacket = worldController->GetPacket(packet->data[0]);
|
||||||
|
WorldEvent *event = new WorldEvent(player->guid);
|
||||||
|
|
||||||
switch (packet->data[0])
|
switch (packet->data[0])
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -376,6 +379,9 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_WORLD_OBJECT_REMOVAL from %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_WORLD_OBJECT_REMOVAL from %s",
|
||||||
player->Npc()->mName.c_str());
|
player->Npc()->mName.c_str());
|
||||||
|
|
||||||
|
myPacket->Read(event);
|
||||||
|
myPacket->Send(event, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace MWWorld
|
||||||
*/
|
*/
|
||||||
MWWorld::CellRef mRef;
|
MWWorld::CellRef mRef;
|
||||||
|
|
||||||
/* Added by TES3MP to prevent dedicated players' references from automatically
|
/* Added by tes3mp to prevent dedicated players' references from automatically
|
||||||
* and unpredictably moving across exterior cell boundaries on clients
|
* and unpredictably moving across exterior cell boundaries on clients
|
||||||
*/
|
*/
|
||||||
bool canChangeCell;
|
bool canChangeCell;
|
||||||
|
|
|
@ -1106,7 +1106,10 @@ namespace MWWorld
|
||||||
&& mWorldScene->getActiveCells().find(ptr.getCell()) != mWorldScene->getActiveCells().end()
|
&& mWorldScene->getActiveCells().find(ptr.getCell()) != mWorldScene->getActiveCells().end()
|
||||||
&& ptr.getRefData().isEnabled())
|
&& ptr.getRefData().isEnabled())
|
||||||
{
|
{
|
||||||
|
// Added by tes3mp
|
||||||
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
|
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
|
||||||
|
event->CellRef()->mRefID = ptr.getCellRef().getRefId();
|
||||||
|
event->CellRef()->mRefNum = ptr.getCellRef().getRefNum();
|
||||||
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_REMOVAL)->Send(event);
|
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_REMOVAL)->Send(event);
|
||||||
|
|
||||||
mWorldScene->removeObjectFromScene (ptr);
|
mWorldScene->removeObjectFromScene (ptr);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_WORLDEVENT_HPP
|
#ifndef OPENMW_WORLDEVENT_HPP
|
||||||
#define OPENMW_WORLDEVENT_HPP
|
#define OPENMW_WORLDEVENT_HPP
|
||||||
|
|
||||||
|
#include <components/esm/cellref.hpp>
|
||||||
#include <RakNetTypes.h>
|
#include <RakNetTypes.h>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
|
@ -19,7 +20,17 @@ namespace mwmp
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual ESM::CellRef *CellRef()
|
||||||
|
{
|
||||||
|
return &ref;
|
||||||
|
}
|
||||||
|
|
||||||
RakNet::RakNetGUID guid;
|
RakNet::RakNetGUID guid;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
ESM::CellRef ref;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,4 +11,6 @@ PacketObjectRemoval::PacketObjectRemoval(RakNet::RakPeerInterface *peer) : World
|
||||||
void PacketObjectRemoval::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send)
|
void PacketObjectRemoval::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send)
|
||||||
{
|
{
|
||||||
WorldPacket::Packet(bs, event, send);
|
WorldPacket::Packet(bs, event, send);
|
||||||
|
|
||||||
|
RW(*event->CellRef(), send);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue