diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index f0c83ef23..fa66029c9 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -370,6 +370,7 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet) WorldPacket *myPacket = worldController->GetPacket(packet->data[0]); WorldEvent *event = new WorldEvent(player->guid); + event->cellRef.blank(); switch (packet->data[0]) { @@ -392,9 +393,8 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet) myPacket->Read(event); - LOG_APPEND(Log::LOG_WARN, "- %s", event->CellRef()->mRefID.c_str()); - - LOG_APPEND(Log::LOG_WARN, "- %i", event->CellRef()->mRefNum); + LOG_APPEND(Log::LOG_WARN, "- %s", event->cellRef.mRefID.c_str()); + LOG_APPEND(Log::LOG_WARN, "- %i", event->cellRef.mRefNum); myPacket->Send(event, true); diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 4ff5d2491..90688ce7e 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -639,9 +639,9 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet) { case ID_WORLD_OBJECT_CREATION: { - MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), event->CellRef()->mRefID, 1); + MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), event->cellRef.mRefID, 1); - MWBase::Environment::get().getWorld()->placeObject(ref.getPtr(), ptrCellStore, event->CellRef()->mPos); + MWBase::Environment::get().getWorld()->placeObject(ref.getPtr(), ptrCellStore, event->cellRef.mPos); break; } @@ -651,10 +651,10 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet) LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_WORLD_OBJECT_REMOVAL"); LOG_APPEND(Log::LOG_WARN, "- cellRefId: %s, %i", - event->CellRef()->mRefID.c_str(), - event->CellRef()->mRefNum); + event->cellRef.mRefID.c_str(), + event->cellRef.mRefNum); - //MWWorld::Ptr object = ptrCellStore->search(event->CellRef()->mRefID); + //MWWorld::Ptr object = ptrCellStore->search(event->cellRef.mRefID); //MWBase::Environment::get().getWorld()->deleteObject(object); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 567351ef8..326fba1ec 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1108,15 +1108,16 @@ namespace MWWorld { // Added by tes3mp mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent(); + event->cellRef.blank(); - event->CellRef()->mRefID = ptr.getCellRef().getRefId(); - event->CellRef()->mRefNum = ptr.getCellRef().getRefNum(); + event->cellRef.mRefID = ptr.getCellRef().getRefId(); + event->cellRef.mRefNum = ptr.getCellRef().getRefNum(); mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_REMOVAL)->Send(event); printf("Sending ID_WORLD_OBJECT_REMOVAL about\n%s\n%s\n%i\n", ptr.getCellRef().getRefId().c_str(), - event->CellRef()->mRefID.c_str(), - event->CellRef()->mRefNum); + event->cellRef.mRefID.c_str(), + event->cellRef.mRefNum); mWorldScene->removeObjectFromScene (ptr); mLocalScripts.remove (ptr); diff --git a/components/openmw-mp/Base/WorldEvent.hpp b/components/openmw-mp/Base/WorldEvent.hpp index e384bbe10..c2a88ff80 100644 --- a/components/openmw-mp/Base/WorldEvent.hpp +++ b/components/openmw-mp/Base/WorldEvent.hpp @@ -20,17 +20,8 @@ namespace mwmp } - virtual ESM::CellRef *CellRef() - { - return &ref; - } - RakNet::RakNetGUID guid; - - protected: - - ESM::CellRef ref; - + ESM::CellRef cellRef; }; } diff --git a/components/openmw-mp/Packets/World/PacketObjectCreation.cpp b/components/openmw-mp/Packets/World/PacketObjectCreation.cpp index d5adb8f7a..02ccd2417 100644 --- a/components/openmw-mp/Packets/World/PacketObjectCreation.cpp +++ b/components/openmw-mp/Packets/World/PacketObjectCreation.cpp @@ -12,5 +12,6 @@ void PacketObjectCreation::Packet(RakNet::BitStream *bs, WorldEvent *event, bool { WorldPacket::Packet(bs, event, send); - RW(*event->CellRef(), send); + RW(event->cellRef.mRefID, send); + RW(event->cellRef.mRefNum, send); } diff --git a/components/openmw-mp/Packets/World/PacketObjectRemoval.cpp b/components/openmw-mp/Packets/World/PacketObjectRemoval.cpp index 0c6b68f53..a23cad4da 100644 --- a/components/openmw-mp/Packets/World/PacketObjectRemoval.cpp +++ b/components/openmw-mp/Packets/World/PacketObjectRemoval.cpp @@ -12,5 +12,6 @@ void PacketObjectRemoval::Packet(RakNet::BitStream *bs, WorldEvent *event, bool { WorldPacket::Packet(bs, event, send); - RW(*event->CellRef(), send); + RW(event->cellRef.mRefID, send); + RW(event->cellRef.mRefNum, send); }