From b3d6dad0c5b2b0fab92ed38889a95b179ab0091f Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sat, 22 Oct 2016 17:10:57 +0300 Subject: [PATCH] Send ID_WORLD_OBJECT_REMOVAL from actiontake.cpp and not worldimp.cpp --- apps/openmw/mwmp/Networking.cpp | 2 +- apps/openmw/mwworld/actiontake.cpp | 16 ++++++++++++++++ apps/openmw/mwworld/worldimp.cpp | 16 ---------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 80f8192ba..10db928cb 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -660,7 +660,7 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet) ptrFound.getCellRef().getRefId().c_str(), ptrFound.getCellRef().getRefNum()); - //MWBase::Environment::get().getWorld()->deleteObject(object); + MWBase::Environment::get().getWorld()->deleteObject(ptrFound); break; } diff --git a/apps/openmw/mwworld/actiontake.cpp b/apps/openmw/mwworld/actiontake.cpp index 4e6135764..02d80de69 100644 --- a/apps/openmw/mwworld/actiontake.cpp +++ b/apps/openmw/mwworld/actiontake.cpp @@ -1,5 +1,8 @@ #include "actiontake.hpp" +#include +#include "../mwmp/Main.hpp" + #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" @@ -17,6 +20,19 @@ namespace MWWorld MWBase::Environment::get().getMechanicsManager()->itemTaken( actor, getTarget(), MWWorld::Ptr(), getTarget().getRefData().getCount()); actor.getClass().getContainerStore (actor).add (getTarget(), getTarget().getRefData().getCount(), actor); + + // Added by tes3mp + mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent(); + event->cellRef.blank(); + + event->cellRef.mRefID = getTarget().getCellRef().getRefId(); + event->cellRef.mRefNum = getTarget().getCellRef().getRefNum(); + mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_REMOVAL)->Send(event); + + printf("Sending ID_WORLD_OBJECT_REMOVAL about %s\n%i\n", + event->cellRef.mRefID.c_str(), + event->cellRef.mRefNum); + MWBase::Environment::get().getWorld()->deleteObject (getTarget()); } } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 326fba1ec..96422fe9e 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -17,9 +17,6 @@ #include -#include -#include "../mwmp/Main.hpp" - #include "../mwbase/environment.hpp" #include "../mwbase/soundmanager.hpp" #include "../mwbase/mechanicsmanager.hpp" @@ -1106,19 +1103,6 @@ namespace MWWorld && mWorldScene->getActiveCells().find(ptr.getCell()) != mWorldScene->getActiveCells().end() && ptr.getRefData().isEnabled()) { - // 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(); - 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); - mWorldScene->removeObjectFromScene (ptr); mLocalScripts.remove (ptr); removeContainerScripts (ptr);