You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/apps/essimporter/convertinventory.cpp

24 lines
871 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.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
objstate.mRef.mCharge = it->mCondition;
state.mItems.push_back(std::make_pair(objstate, it->mRelativeEquipmentSlot));
}
}
}