Load methods (for ESM records) accept a deleted flag in ESSImporter

pull/678/head
Stanislav Bas 10 years ago
parent 8243fb2479
commit 0c6ab6cc94

@ -158,7 +158,9 @@ namespace ESSImport
void ConvertCell::read(ESM::ESMReader &esm)
{
ESM::Cell cell;
cell.load(esm, false);
bool isDeleted = false;
cell.load(esm, isDeleted, false);
// I wonder what 0x40 does?
if (cell.isExterior() && cell.mData.mFlags & 0x20)

@ -54,6 +54,8 @@ public:
void setContext(Context& context) { mContext = &context; }
/// @note The load method of ESM records accept the deleted flag as a parameter.
/// I don't know can the DELE sub-record appear in saved games, so the deleted flag will be ignored.
virtual void read(ESM::ESMReader& esm)
{
}
@ -79,7 +81,9 @@ public:
virtual void read(ESM::ESMReader& esm)
{
T record;
record.load(esm);
bool isDeleted = false;
record.load(esm, isDeleted);
mRecords[record.mId] = record;
}
@ -103,7 +107,9 @@ public:
virtual void read(ESM::ESMReader &esm)
{
ESM::NPC npc;
npc.load(esm);
bool isDeleted = false;
npc.load(esm, isDeleted);
if (npc.mId != "player")
{
// Handles changes to the NPC struct, but since there is no index here
@ -139,7 +145,9 @@ public:
{
// See comment in ConvertNPC
ESM::Creature creature;
creature.load(esm);
bool isDeleted = false;
creature.load(esm, isDeleted);
mContext->mCreatures[Misc::StringUtils::lowerCase(creature.mId)] = creature;
}
};
@ -154,7 +162,9 @@ public:
virtual void read(ESM::ESMReader &esm)
{
ESM::Global global;
global.load(esm);
bool isDeleted = false;
global.load(esm, isDeleted);
if (Misc::StringUtils::ciEqual(global.mId, "gamehour"))
mContext->mHour = global.mValue.getFloat();
if (Misc::StringUtils::ciEqual(global.mId, "day"))
@ -173,8 +183,9 @@ public:
virtual void read(ESM::ESMReader &esm)
{
ESM::Class class_;
class_.load(esm);
bool isDeleted = false;
class_.load(esm, isDeleted);
if (class_.mId == "NEWCLASSID_CHARGEN")
mContext->mCustomPlayerClassName = class_.mName;
@ -188,7 +199,9 @@ public:
virtual void read(ESM::ESMReader &esm)
{
ESM::Book book;
book.load(esm);
bool isDeleted = false;
book.load(esm, isDeleted);
if (book.mData.mSkillID == -1)
mContext->mPlayer.mObject.mNpcStats.mUsedIds.push_back(Misc::StringUtils::lowerCase(book.mId));
@ -365,7 +378,9 @@ public:
virtual void read(ESM::ESMReader& esm)
{
ESM::Faction faction;
faction.load(esm);
bool isDeleted = false;
faction.load(esm, isDeleted);
std::string id = Misc::StringUtils::toLower(faction.mId);
for (std::map<std::string, int>::const_iterator it = faction.mReactions.begin(); it != faction.mReactions.end(); ++it)

@ -18,7 +18,8 @@ namespace ESSImport
if (esm.isNextSub("MNAM"))
esm.skipHSub();
ESM::CellRef::loadData(esm);
bool isDeleted = false;
ESM::CellRef::loadData(esm, isDeleted);
mHasACDT = false;
if (esm.isNextSub("ACDT"))

@ -32,7 +32,8 @@ namespace ESSImport
item.mSCRI.load(esm);
// for XSOL and XCHG seen so far, but probably others too
item.ESM::CellRef::loadData(esm);
bool isDeleted = false;
item.ESM::CellRef::loadData(esm, isDeleted);
int charge=-1;
esm.getHNOT(charge, "XHLT");

Loading…
Cancel
Save