From 58571f7ac2c250ae73674f0225854c2b2f38b9b9 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 28 Sep 2014 12:18:46 +0200 Subject: [PATCH] Revert "Transfer item ownership to the buyer if item wasn't stolen" Fixes #1953. This reverts commit 5d77c5e8cac1c506f50a9e415dfeb489c0704ddb. --- apps/openmw/mwgui/containeritemmodel.cpp | 2 +- apps/openmw/mwgui/tradeitemmodel.cpp | 8 +++----- apps/openmw/mwgui/tradeitemmodel.hpp | 3 +-- apps/openmw/mwgui/tradewindow.cpp | 4 ++-- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwgui/containeritemmodel.cpp b/apps/openmw/mwgui/containeritemmodel.cpp index 520a32ef8..b2befc3ba 100644 --- a/apps/openmw/mwgui/containeritemmodel.cpp +++ b/apps/openmw/mwgui/containeritemmodel.cpp @@ -76,7 +76,7 @@ MWWorld::Ptr ContainerItemModel::copyItem (const ItemStack& item, size_t count, const MWWorld::Ptr& source = mItemSources[mItemSources.size()-1]; if (item.mBase.getContainerStore() == &source.getClass().getContainerStore(source)) throw std::runtime_error("Item to copy needs to be from a different container!"); - return *source.getClass().getContainerStore(source).add(item.mBase, count, source, setNewOwner); + return *source.getClass().getContainerStore(source).add(item.mBase, count, source); } void ContainerItemModel::removeItem (const ItemStack& item, size_t count) diff --git a/apps/openmw/mwgui/tradeitemmodel.cpp b/apps/openmw/mwgui/tradeitemmodel.cpp index e1283c89d..3abfac997 100644 --- a/apps/openmw/mwgui/tradeitemmodel.cpp +++ b/apps/openmw/mwgui/tradeitemmodel.cpp @@ -119,7 +119,7 @@ namespace MWGui return mBorrowedToUs; } - void TradeItemModel::transferItems(const MWWorld::Ptr& transferFrom) + void TradeItemModel::transferItems() { std::vector::iterator it = mBorrowedToUs.begin(); for (; it != mBorrowedToUs.end(); ++it) @@ -135,11 +135,9 @@ namespace MWGui if (i == sourceModel->getItemCount()) throw std::runtime_error("The borrowed item disappeared"); + // reset owner while copying, but only for items bought by the player + bool setNewOwner = (mMerchant.isEmpty()); const ItemStack& item = sourceModel->getItem(i); - - bool setNewOwner = Misc::StringUtils::ciEqual(item.mBase.getCellRef().getOwner(), transferFrom.getCellRef().getRefId()) - || item.mBase.getCellRef().getOwner().empty(); - // copy the borrowed items to our model copyItem(item, it->mCount, setNewOwner); // then remove them from the source model diff --git a/apps/openmw/mwgui/tradeitemmodel.hpp b/apps/openmw/mwgui/tradeitemmodel.hpp index c463bf40b..1bfee9b2a 100644 --- a/apps/openmw/mwgui/tradeitemmodel.hpp +++ b/apps/openmw/mwgui/tradeitemmodel.hpp @@ -30,8 +30,7 @@ namespace MWGui void returnItemBorrowedFromUs (ModelIndex itemIndex, ItemModel* source, size_t count); /// Permanently transfers items that were borrowed to us from another model to this model - /// @param transferFrom the actor that lent us the items - void transferItems (const MWWorld::Ptr& transferFrom); + void transferItems (); /// Aborts trade void abort(); diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index 081a1e2c2..a4e5bbc16 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -370,8 +370,8 @@ namespace MWGui MWBase::Environment::get().getDialogueManager()->applyDispositionChange(iBarterSuccessDisposition); // make the item transfer - mTradeModel->transferItems(player); - playerItemModel->transferItems(mPtr); + mTradeModel->transferItems(); + playerItemModel->transferItems(); // transfer the gold if (mCurrentBalance != 0)