From c5185cf2e4f750845594986e0ee87edf74148e22 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 17 May 2012 12:09:53 +0200 Subject: [PATCH] drop item on avatar from external container bugfix --- apps/openmw/mwgui/container.cpp | 2 -- apps/openmw/mwgui/container.hpp | 6 ------ apps/openmw/mwgui/inventorywindow.cpp | 3 ++- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 8bb3976da..3656a8919 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -136,8 +136,6 @@ void ContainerBase::onSelectedItemImpl(MyGUI::Widget* _sender, int count) static_cast(mSelectedItem->getChildAt(0)->getChildAt(0))->setCaption( getCountString(mDragAndDrop->mDraggedCount)); - mDragAndDrop->mWasInInventory = isInventory(); - drawItems(); MWBase::Environment::get().getWindowManager()->setDragDrop(true); diff --git a/apps/openmw/mwgui/container.hpp b/apps/openmw/mwgui/container.hpp index 174f18f9a..fe4ffc285 100644 --- a/apps/openmw/mwgui/container.hpp +++ b/apps/openmw/mwgui/container.hpp @@ -36,17 +36,11 @@ namespace MWGui class DragAndDrop { public: - DragAndDrop() : - mWasInInventory(false) - { - } - bool mIsOnDragAndDrop; MyGUI::Widget* mDraggedWidget; MyGUI::Widget* mDragAndDropWidget; ContainerBase* mDraggedFrom; int mDraggedCount; - bool mWasInInventory; // was the item in inventory before it was dragged }; class ContainerBase diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 9773867ec..4f16152ea 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -157,6 +157,7 @@ namespace MWGui ptr.getRefData().setCount(origCount - mDragAndDrop->mDraggedCount); it = invStore.add(ptr); (*it).getRefData().setCount(mDragAndDrop->mDraggedCount); + ptr = *it; } /// \todo scripts @@ -169,7 +170,7 @@ namespace MWGui // the "Take" button should not be visible. // NOTE: the take button is "reset" when the window opens, so we can safely do the following // without screwing up future book windows - if (mDragAndDrop->mWasInInventory) + if (mDragAndDrop->mDraggedFrom == this) { mWindowManager.getBookWindow()->setTakeButtonShow(false); mWindowManager.getScrollWindow()->setTakeButtonShow(false);