mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Fix unhandled edge case in TradeItemModel with items that are able to stack, but are not currently stacked (e.g. after repairing a damaged item)
Fixes #1368
This commit is contained in:
parent
16ac6e7aac
commit
de7fcf0beb
2 changed files with 6 additions and 6 deletions
|
@ -100,7 +100,7 @@ namespace MWGui
|
|||
for (size_t i=0; i<mSourceModel->getItemCount(); ++i)
|
||||
{
|
||||
const ItemStack& item = mSourceModel->getItem(i);
|
||||
if (item == itemToSearch)
|
||||
if (item.mBase == itemToSearch.mBase)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
|
@ -112,7 +112,7 @@ namespace MWGui
|
|||
for (size_t i=0; i<getItemCount(); ++i)
|
||||
{
|
||||
const ItemStack& item = getItem(i);
|
||||
if (item == itemToSearch)
|
||||
if (item.mBase == itemToSearch.mBase)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace MWGui
|
|||
bool found = false;
|
||||
for (; it != out.end(); ++it)
|
||||
{
|
||||
if (it->stacks(item))
|
||||
if (it->mBase == item.mBase)
|
||||
{
|
||||
it->mCount += item.mCount;
|
||||
found = true;
|
||||
|
@ -52,7 +52,7 @@ namespace MWGui
|
|||
bool found = false;
|
||||
for (; it != out.end(); ++it)
|
||||
{
|
||||
if (it->stacks(item))
|
||||
if (it->mBase == item.mBase)
|
||||
{
|
||||
if (it->mCount < count)
|
||||
throw std::runtime_error("Not enough borrowed items to return");
|
||||
|
@ -114,7 +114,7 @@ namespace MWGui
|
|||
size_t i=0;
|
||||
for (; i<sourceModel->getItemCount(); ++i)
|
||||
{
|
||||
if (it->stacks(sourceModel->getItem(i)))
|
||||
if (it->mBase == sourceModel->getItem(i).mBase)
|
||||
break;
|
||||
}
|
||||
if (i == sourceModel->getItemCount())
|
||||
|
@ -182,7 +182,7 @@ namespace MWGui
|
|||
std::vector<ItemStack>::iterator it = mBorrowedFromUs.begin();
|
||||
for (; it != mBorrowedFromUs.end(); ++it)
|
||||
{
|
||||
if (it->stacks(item))
|
||||
if (it->mBase == item.mBase)
|
||||
{
|
||||
if (item.mCount < it->mCount)
|
||||
throw std::runtime_error("Lent more items than present");
|
||||
|
|
Loading…
Reference in a new issue