forked from mirror/openmw-tes3mp
ESSImport: add some subrecords to CellRef and others, most files should load now, importacdt/cellref class structure need some refactoring
parent
08ad4d73bb
commit
19ed047dec
@ -0,0 +1,46 @@
|
||||
#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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
#ifndef OPENMW_ESSIMPORT_IMPORTINVENTORY_H
|
||||
#define OPENMW_ESSIMPORT_IMPORTINVENTORY_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <components/esm/cellref.hpp>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
class ESMReader;
|
||||
}
|
||||
|
||||
namespace ESSImport
|
||||
{
|
||||
|
||||
struct Inventory
|
||||
{
|
||||
struct InventoryItem : public ESM::CellRef
|
||||
{
|
||||
std::string mId;
|
||||
int mCondition;
|
||||
};
|
||||
std::vector<InventoryItem> mItems;
|
||||
|
||||
void load(ESM::ESMReader& esm);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue