mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 20:19:57 +00:00
[Client] Send ID_CONTAINER when starting to drag a container item
This commit is contained in:
parent
9f8bed9be1
commit
9c76b805b2
2 changed files with 34 additions and 3 deletions
|
@ -2,7 +2,11 @@
|
|||
|
||||
#include <MyGUI_InputManager.h>
|
||||
#include <MyGUI_Button.h>
|
||||
|
||||
#include <components/openmw-mp/Log.hpp>
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/LocalEvent.hpp"
|
||||
#include "../mwmp/WorldController.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
@ -97,6 +101,33 @@ namespace MWGui
|
|||
if (!onTakeItem(mModel->getItem(mSelectedItem), count))
|
||||
return;
|
||||
|
||||
// Added by tes3mp
|
||||
mwmp::LocalEvent *event = mwmp::Main::get().getNetworking()->createLocalEvent();
|
||||
event->cell = *mPtr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = mPtr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = mPtr.getCellRef().getRefNum().mIndex;
|
||||
event->addObject(worldObject);
|
||||
|
||||
mwmp::ContainerItem containerItem;
|
||||
containerItem.refId = mModel->getItem(mSelectedItem).mBase.getCellRef().getRefId();
|
||||
containerItem.count = count;
|
||||
event->addContainerItem(containerItem);
|
||||
event->containerChanges.action = mwmp::ContainerChanges::REMOVE;
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send(event);
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s, %i\n- cell: %s\n- item: %s, %i",
|
||||
worldObject.refId.c_str(),
|
||||
worldObject.refNumIndex,
|
||||
event->cell.getDescription().c_str(),
|
||||
containerItem.refId,
|
||||
containerItem.count);
|
||||
|
||||
delete event;
|
||||
event = NULL;
|
||||
|
||||
mDragAndDrop->startDrag(mSelectedItem, mSortModel, mModel, mItemView, count);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ namespace MWWorld
|
|||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event);
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_DELETE about\n- cellRef: %s, %i\n- cell: %s.",
|
||||
getTarget().getCellRef().getRefId().c_str(),
|
||||
getTarget().getCellRef().getRefNum().mIndex,
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_DELETE about\n- cellRef: %s, %i\n- cell: %s",
|
||||
worldObject.refId.c_str(),
|
||||
worldObject.refNumIndex,
|
||||
event->cell.getDescription().c_str());
|
||||
|
||||
delete event;
|
||||
|
|
Loading…
Reference in a new issue