|
|
|
@ -27,6 +27,8 @@ namespace
|
|
|
|
|
objstate.mEnabled = cellref.mEnabled;
|
|
|
|
|
objstate.mPosition = cellref.mPos;
|
|
|
|
|
objstate.mRef.mRefNum = cellref.mRefNum;
|
|
|
|
|
if (cellref.mDeleted)
|
|
|
|
|
objstate.mCount = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isIndexedRefId(const std::string& indexedRefId)
|
|
|
|
@ -34,6 +36,10 @@ namespace
|
|
|
|
|
if (indexedRefId.size() <= 8)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (indexedRefId.find_first_not_of("0123456789") == std::string::npos)
|
|
|
|
|
return false; // entirely numeric refid, this is a reference to
|
|
|
|
|
// a dynamically created record e.g. player-enchanted weapon
|
|
|
|
|
|
|
|
|
|
std::string index = indexedRefId.substr(indexedRefId.size()-8);
|
|
|
|
|
if(index.find_first_not_of("0123456789ABCDEF") == std::string::npos )
|
|
|
|
|
return true;
|
|
|
|
@ -136,13 +142,6 @@ namespace ESSImport
|
|
|
|
|
{
|
|
|
|
|
CellRef ref;
|
|
|
|
|
ref.load (esm);
|
|
|
|
|
if (esm.isNextSub("DELE"))
|
|
|
|
|
{
|
|
|
|
|
// TODO
|
|
|
|
|
// strangely this can be e.g. 52 instead of just 1,
|
|
|
|
|
//std::cout << "deleted ref " << ref.mIndexedRefId << std::endl;
|
|
|
|
|
esm.skipHSub();
|
|
|
|
|
}
|
|
|
|
|
cellrefs.push_back(ref);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -201,8 +200,7 @@ namespace ESSImport
|
|
|
|
|
for (std::vector<CellRef>::const_iterator refIt = cell.mRefs.begin(); refIt != cell.mRefs.end(); ++refIt)
|
|
|
|
|
{
|
|
|
|
|
const CellRef& cellref = *refIt;
|
|
|
|
|
ESM::CellRef out;
|
|
|
|
|
out.blank();
|
|
|
|
|
ESM::CellRef out (cellref);
|
|
|
|
|
|
|
|
|
|
if (!isIndexedRefId(cellref.mIndexedRefId))
|
|
|
|
|
{
|
|
|
|
@ -241,8 +239,8 @@ namespace ESSImport
|
|
|
|
|
objstate.mRef.mRefID = idLower;
|
|
|
|
|
// probably need more micromanagement here so we don't overwrite values
|
|
|
|
|
// from the ESM with default values
|
|
|
|
|
convertACDT(cellref.mActorData.mACDT, objstate.mCreatureStats);
|
|
|
|
|
convertNpcData(cellref.mActorData, objstate.mNpcStats);
|
|
|
|
|
convertACDT(cellref.mACDT, objstate.mCreatureStats);
|
|
|
|
|
convertNpcData(cellref, objstate.mNpcStats);
|
|
|
|
|
convertNPCC(npccIt->second, objstate);
|
|
|
|
|
convertCellRef(cellref, objstate);
|
|
|
|
|
esm.writeHNT ("OBJE", ESM::REC_NPC_);
|
|
|
|
@ -273,7 +271,7 @@ namespace ESSImport
|
|
|
|
|
objstate.blank();
|
|
|
|
|
objstate.mRef = out;
|
|
|
|
|
objstate.mRef.mRefID = idLower;
|
|
|
|
|
convertACDT(cellref.mActorData.mACDT, objstate.mCreatureStats);
|
|
|
|
|
convertACDT(cellref.mACDT, objstate.mCreatureStats);
|
|
|
|
|
// probably need more micromanagement here so we don't overwrite values
|
|
|
|
|
// from the ESM with default values
|
|
|
|
|
convertCREC(crecIt->second, objstate);
|
|
|
|
|