mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
ESSImport: Correctly handle item stacks (XIDX tag). (Fixes #3340)
This commit is contained in:
parent
ba3f4f122a
commit
8cf91e32fa
@ -21,13 +21,18 @@ namespace ESSImport
|
|||||||
item.mCount = contItem.mCount;
|
item.mCount = contItem.mCount;
|
||||||
item.mRelativeEquipmentSlot = -1;
|
item.mRelativeEquipmentSlot = -1;
|
||||||
|
|
||||||
// seems that a stack of items can have a set of subrecords for each item? rings0000.ess
|
unsigned int itemCount = std::abs(item.mCount);
|
||||||
// doesn't make any sense to me, if the values were different then the items shouldn't stack in the first place?
|
bool separateStacks = false;
|
||||||
// I guess we should double check the stacking logic in OpenMW
|
for (unsigned int i=0;i<itemCount;++i)
|
||||||
for (int i=0;i<std::abs(item.mCount);++i)
|
|
||||||
{
|
{
|
||||||
if (esm.isNextSub("XIDX")) // index in the stack?
|
bool newStack = esm.isNextSub("XIDX");
|
||||||
esm.skipHSub();
|
if (newStack)
|
||||||
|
{
|
||||||
|
unsigned int idx;
|
||||||
|
esm.getHT(idx);
|
||||||
|
separateStacks = true;
|
||||||
|
item.mCount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
item.mSCRI.load(esm);
|
item.mSCRI.load(esm);
|
||||||
|
|
||||||
@ -38,9 +43,13 @@ namespace ESSImport
|
|||||||
int charge=-1;
|
int charge=-1;
|
||||||
esm.getHNOT(charge, "XHLT");
|
esm.getHNOT(charge, "XHLT");
|
||||||
item.mChargeInt = charge;
|
item.mChargeInt = charge;
|
||||||
|
|
||||||
|
if (newStack)
|
||||||
|
mItems.push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
mItems.push_back(item);
|
if (!separateStacks)
|
||||||
|
mItems.push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// equipped items
|
// equipped items
|
||||||
|
Loading…
Reference in New Issue
Block a user