1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-03 17:37:18 +00:00
OpenMW/apps/essimporter/convertinventory.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
1.0 KiB
C++
Raw Normal View History

#include "convertinventory.hpp"
#include <components/misc/strings/lower.hpp>
2016-01-25 13:13:16 +00:00
#include <cstdlib>
namespace ESSImport
{
void convertInventory(const Inventory& inventory, ESM::InventoryState& state)
{
uint32_t index = 0;
2020-06-10 06:30:37 +00:00
for (const auto& item : inventory.mItems)
{
ESM::ObjectState objstate;
objstate.blank();
2020-06-10 06:30:37 +00:00
objstate.mRef = item;
objstate.mRef.mRefID = ESM::RefId::stringRefId(item.mId);
2023-12-31 17:12:46 +00:00
objstate.mRef.mCount = item.mCount;
state.mItems.push_back(objstate);
2020-06-10 06:30:37 +00:00
if (item.mRelativeEquipmentSlot != -1)
// Note we should really write the absolute slot here, which we do not know about
// Not a big deal, OpenMW will auto-correct to a valid slot, the only problem is when
// an item could be equipped in two different slots (e.g. equipped two rings)
2020-06-10 06:30:37 +00:00
state.mEquipmentSlots[index] = item.mRelativeEquipmentSlot;
++index;
}
}
}