From 762460f04200afbc7a95011b4d684be0838fd52d Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 22 Nov 2016 22:41:08 +0100 Subject: [PATCH] Use negative count when restocking item to ensure that its properly tracked (Fixes #3635) --- apps/openmw/mwworld/containerstore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index dbdec80814..10388a3b0a 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -553,14 +553,14 @@ void MWWorld::ContainerStore::restock (const ESM::InventoryList& items, const MW if(listInMap != allowedForReplace.end()) restockNum -= std::min(restockNum, listInMap->second); //restock - addInitialItem(itemOrList, owner, restockNum, true); + addInitialItem(itemOrList, owner, -restockNum, true); } else { //Restocking static item - just restock to the max count int currentCount = count(itemOrList); if (currentCount < std::abs(it->mCount)) - addInitialItem(itemOrList, owner, std::abs(it->mCount) - currentCount, true); + addInitialItem(itemOrList, owner, -(std::abs(it->mCount) - currentCount), true); } } flagAsModified();