diff options
author | scrawl <scrawl@baseoftrash.de> | 2016-01-12 17:10:23 +0100 |
---|---|---|
committer | scrawl <scrawl@baseoftrash.de> | 2016-01-12 17:11:28 +0100 |
commit | 471ad3fb0f0f4b332057e3fa7ee277dc780abcc2 (patch) | |
tree | 40724388cb19edffe6f526ab5de376c77cfd491a | |
parent | fde831e2e03281b1461e317318ebb1be82785e00 (diff) |
Fix an error in restocking logic (Fixes #3131)openmw-0.38.0
-rw-r--r-- | apps/openmw/mwworld/containerstore.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index ab9fa46110..45390405e0 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -529,10 +529,10 @@ void MWWorld::ContainerStore::restock (const ESM::InventoryList& items, const MW { std::map<std::string, int>::iterator listInMap = allowedForReplace.find(itemOrList); - int restockNum = it->mCount; + int restockNum = std::abs(it->mCount); //If we know we must restock less, take it into account if(listInMap != allowedForReplace.end()) - restockNum += listInMap->second;//We add, because list items have negative count + restockNum -= std::min(restockNum, listInMap->second); //restock addInitialItem(itemOrList, owner, restockNum, true); } |