Revert "Revert "ESSImport: convert inventory equipment slots""

This reverts commit fe31ca0ac0.
pull/453/head
scrawl 10 years ago
parent d13335ba40
commit 7ead963075

@ -16,7 +16,7 @@ namespace ESSImport
objstate.mCount = std::abs(it->mCount); // restocking items have negative count in the savefile objstate.mCount = std::abs(it->mCount); // restocking items have negative count in the savefile
// openmw handles them differently, so no need to set any flags // openmw handles them differently, so no need to set any flags
objstate.mRef.mCharge = it->mCondition; objstate.mRef.mCharge = it->mCondition;
state.mItems.push_back(std::make_pair(objstate, -1)); state.mItems.push_back(std::make_pair(objstate, it->mRelativeEquipmentSlot));
} }
} }

@ -1,5 +1,7 @@
#include "importinventory.hpp" #include "importinventory.hpp"
#include <stdexcept>
#include <components/esm/esmreader.hpp> #include <components/esm/esmreader.hpp>
#include <components/esm/loadcont.hpp> #include <components/esm/loadcont.hpp>
@ -17,6 +19,7 @@ namespace ESSImport
InventoryItem item; InventoryItem item;
item.mId = contItem.mItem.toString(); item.mId = contItem.mItem.toString();
item.mCount = contItem.mCount; item.mCount = contItem.mCount;
item.mRelativeEquipmentSlot = -1;
// seems that a stack of items can have a set of subrecords for each item? rings0000.ess // seems that a stack of items can have a set of subrecords for each item? rings0000.ess
// doesn't make any sense to me, if the values were different then the items shouldn't stack in the first place? // doesn't make any sense to me, if the values were different then the items shouldn't stack in the first place?
@ -55,14 +58,21 @@ namespace ESSImport
{ {
// note: same item can be equipped 2 items (e.g. 2 rings) // note: same item can be equipped 2 items (e.g. 2 rings)
// and will be *stacked* in the NPCO list, unlike openmw! // and will be *stacked* in the NPCO list, unlike openmw!
// this is currently not handled properly.
esm.getSubHeader(); esm.getSubHeader();
int itemIndex; // index of the item in the NPCO list int itemIndex; // index of the item in the NPCO list
esm.getT(itemIndex); esm.getT(itemIndex);
if (itemIndex < 0 || itemIndex >= int(mItems.size()))
esm.fail("equipment item index out of range");
// appears to be a relative index for only the *possible* slots this item can be equipped in, // appears to be a relative index for only the *possible* slots this item can be equipped in,
// i.e. 0 most of the time, unlike openmw slot enum index // i.e. 0 most of the time
int slotIndex; int slotIndex;
esm.getT(slotIndex); esm.getT(slotIndex);
mItems[itemIndex].mRelativeEquipmentSlot = slotIndex;
} }
} }

@ -21,6 +21,7 @@ namespace ESSImport
std::string mId; std::string mId;
int mCount; int mCount;
int mCondition; int mCondition;
int mRelativeEquipmentSlot;
}; };
std::vector<InventoryItem> mItems; std::vector<InventoryItem> mItems;

Loading…
Cancel
Save