mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
[Client] Move code for sending a packet for picking up world items
Previously, an ID_OBJECT_DELETE was sent from inventorywindow.cpp, but this is now sent from hud.cpp because 2 other packets are also sent from there.
This commit is contained in:
parent
b2cdec8efa
commit
c0d67f67fb
2 changed files with 15 additions and 18 deletions
|
@ -311,7 +311,22 @@ namespace MWGui
|
|||
{
|
||||
// pick up object
|
||||
if (!object.isEmpty())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->pickUpObject(object);
|
||||
|
||||
// Added by tes3mp
|
||||
mwmp::LocalEvent *event = mwmp::Main::get().getNetworking()->createLocalEvent();
|
||||
event->cell = *object.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = object.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = object.getCellRef().getRefNum().mIndex;
|
||||
event->addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event);
|
||||
delete event;
|
||||
event = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,6 @@
|
|||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/LocalEvent.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
@ -634,19 +629,6 @@ namespace MWGui
|
|||
// can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object
|
||||
MWWorld::Ptr newObject = *player.getClass().getContainerStore (player).add (object, object.getRefData().getCount(), player);
|
||||
|
||||
// Added by tes3mp
|
||||
mwmp::LocalEvent *event = mwmp::Main::get().getNetworking()->createLocalEvent();
|
||||
event->cell = *object.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = object.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = object.getCellRef().getRefNum().mIndex;
|
||||
event->addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event);
|
||||
delete event;
|
||||
event = nullptr;
|
||||
|
||||
// remove from world
|
||||
MWBase::Environment::get().getWorld()->deleteObject (object);
|
||||
|
||||
|
|
Loading…
Reference in a new issue