mirror of https://github.com/OpenMW/openmw.git
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.
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
10 years ago
|
#include "importinventory.hpp"
|
||
|
|
||
|
#include <components/esm/esmreader.hpp>
|
||
|
|
||
|
namespace ESSImport
|
||
|
{
|
||
|
|
||
|
void Inventory::load(ESM::ESMReader &esm)
|
||
|
{
|
||
|
while (esm.isNextSub("NPCO"))
|
||
|
{
|
||
|
InventoryItem item;
|
||
|
item.mId = esm.getHString();
|
||
|
|
||
|
if (esm.isNextSub("XIDX"))
|
||
|
esm.skipHSub();
|
||
|
|
||
|
std::string script = esm.getHNOString("SCRI");
|
||
|
// script variables?
|
||
|
// unsure if before or after ESM::CellRef
|
||
|
if (!script.empty())
|
||
|
{
|
||
|
if (esm.isNextSub("SLCS"))
|
||
|
esm.skipHSub();
|
||
|
if (esm.isNextSub("SLSD")) // Short Data?
|
||
|
esm.skipHSub();
|
||
|
if (esm.isNextSub("SLFD")) // Float Data?
|
||
|
esm.skipHSub();
|
||
|
}
|
||
|
|
||
|
// for XSOL and XCHG seen so far, but probably others too
|
||
|
item.ESM::CellRef::loadData(esm);
|
||
|
|
||
|
item.mCondition = -1;
|
||
|
esm.getHNOT(item.mCondition, "XHLT");
|
||
|
mItems.push_back(item);
|
||
|
}
|
||
|
|
||
|
while (esm.isNextSub("WIDX"))
|
||
|
{
|
||
|
// equipping?
|
||
|
esm.skipHSub();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|