forked from mirror/openmw-tes3mp
ESSImport: inventory loading works, equipment slots need more work
parent
f7e32a24c9
commit
a7b82e5107
@ -0,0 +1,13 @@
|
||||
#include "convertcrec.hpp"
|
||||
|
||||
#include "convertinventory.hpp"
|
||||
|
||||
namespace ESSImport
|
||||
{
|
||||
|
||||
void convertCREC(const CREC &crec, ESM::CreatureState &state)
|
||||
{
|
||||
convertInventory(crec.mInventory, state.mInventory);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
#ifndef OPENMW_ESSIMPORT_CONVERTCREC_H
|
||||
#define OPENMW_ESSIMPORT_CONVERTCREC_H
|
||||
|
||||
#include "importcrec.hpp"
|
||||
|
||||
#include <components/esm/creaturestate.hpp>
|
||||
|
||||
namespace ESSImport
|
||||
{
|
||||
|
||||
void convertCREC(const CREC& crec, ESM::CreatureState& state);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,23 @@
|
||||
#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, -1));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
#ifndef OPENMW_ESSIMPORT_CONVERTINVENTORY_H
|
||||
#define OPENMW_ESSIMPORT_CONVERTINVENTORY_H
|
||||
|
||||
#include "importinventory.hpp"
|
||||
|
||||
#include <components/esm/inventorystate.hpp>
|
||||
|
||||
namespace ESSImport
|
||||
{
|
||||
|
||||
void convertInventory (const Inventory& inventory, ESM::InventoryState& state);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,10 +1,14 @@
|
||||
#include "convertnpcc.hpp"
|
||||
|
||||
#include "convertinventory.hpp"
|
||||
|
||||
namespace ESSImport
|
||||
{
|
||||
|
||||
void convertNPCC(const NPCC &npcc, ESM::NpcState &npcState)
|
||||
{
|
||||
npcState.mNpcStats.mReputation = npcc.mNPDT.mReputation;
|
||||
|
||||
convertInventory(npcc.mInventory, npcState.mInventory);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue