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

24 lines
852 B
C++

#include "convertinventory.hpp"
#include <components/misc/stringops.hpp>
namespace ESSImport
{
void convertInventory(const Inventory &inventory, ESM::InventoryState &state)
{
for (std::vector<Inventory::InventoryItem>::const_iterator it = inventory.mItems.begin();
it != inventory.mItems.end(); ++it)
{
ESM::ObjectState objstate;
objstate.blank();
objstate.mRef = *it;
objstate.mRef.mRefID = Misc::StringUtils::lowerCase(it->mId);
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
state.mItems.push_back(std::make_pair(objstate, it->mRelativeEquipmentSlot));
}
}
}