[Client] Send ID_CONTAINER when starting to drag a container item

coverity_scan^2
David Cernat 8 years ago
parent 9f8bed9be1
commit 9c76b805b2

@ -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…
Cancel
Save