[Client] See when other players add items to containers

coverity_scan^2
David Cernat 8 years ago
parent 75392297b5
commit d2c5a3387a

@ -154,6 +154,33 @@ namespace MWGui
}
}
// 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 = mDragAndDrop->mItem.mBase.getCellRef().getRefId();
containerItem.count = mDragAndDrop->mItem.mBase.getRefData().getCount();
event->addContainerItem(containerItem);
event->containerChanges.action = mwmp::ContainerChanges::ADD;
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->drop(mModel, mItemView);
}

@ -72,7 +72,11 @@ void LocalEvent::editContainer(MWWorld::CellStore* cellStore)
{
ContainerItem item = containerChanges.items.at(i);
if (containerChanges.action == ContainerChanges::REMOVE)
if (containerChanges.action == ContainerChanges::ADD)
{
containerStore.add(item.refId, item.count, mwmp::Players::getPlayer(guid)->getPtr());
}
else if (containerChanges.action == ContainerChanges::REMOVE)
{
containerStore.remove(item.refId, item.count, mwmp::Players::getPlayer(guid)->getPtr());
}

Loading…
Cancel
Save