Send ID_WORLD_OBJECT_REMOVAL from actiontake.cpp and not worldimp.cpp

coverity_scan^2
David Cernat 8 years ago
parent cc98a25dcf
commit b3d6dad0c5

@ -660,7 +660,7 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
ptrFound.getCellRef().getRefId().c_str(), ptrFound.getCellRef().getRefId().c_str(),
ptrFound.getCellRef().getRefNum()); ptrFound.getCellRef().getRefNum());
//MWBase::Environment::get().getWorld()->deleteObject(object); MWBase::Environment::get().getWorld()->deleteObject(ptrFound);
break; break;
} }

@ -1,5 +1,8 @@
#include "actiontake.hpp" #include "actiontake.hpp"
#include <components/openmw-mp/Base/WorldEvent.hpp>
#include "../mwmp/Main.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
@ -17,6 +20,19 @@ namespace MWWorld
MWBase::Environment::get().getMechanicsManager()->itemTaken( MWBase::Environment::get().getMechanicsManager()->itemTaken(
actor, getTarget(), MWWorld::Ptr(), getTarget().getRefData().getCount()); actor, getTarget(), MWWorld::Ptr(), getTarget().getRefData().getCount());
actor.getClass().getContainerStore (actor).add (getTarget(), getTarget().getRefData().getCount(), actor); 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()); MWBase::Environment::get().getWorld()->deleteObject (getTarget());
} }
} }

@ -17,9 +17,6 @@
#include <components/sceneutil/positionattitudetransform.hpp> #include <components/sceneutil/positionattitudetransform.hpp>
#include <components/openmw-mp/Base/WorldEvent.hpp>
#include "../mwmp/Main.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
@ -1106,19 +1103,6 @@ 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();
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); mWorldScene->removeObjectFromScene (ptr);
mLocalScripts.remove (ptr); mLocalScripts.remove (ptr);
removeContainerScripts (ptr); removeContainerScripts (ptr);

Loading…
Cancel
Save