From 0c6ab6cc9449e14fe30d1f9baa3424b92eee9ba8 Mon Sep 17 00:00:00 2001 From: Stanislav Bas Date: Tue, 21 Jul 2015 21:49:36 +0300 Subject: [PATCH] Load methods (for ESM records) accept a deleted flag in ESSImporter --- apps/essimporter/converter.cpp | 4 +++- apps/essimporter/converter.hpp | 29 +++++++++++++++++++++------- apps/essimporter/importacdt.cpp | 3 ++- apps/essimporter/importinventory.cpp | 3 ++- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/apps/essimporter/converter.cpp b/apps/essimporter/converter.cpp index 982753134..1d1942a3e 100644 --- a/apps/essimporter/converter.cpp +++ b/apps/essimporter/converter.cpp @@ -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) diff --git a/apps/essimporter/converter.hpp b/apps/essimporter/converter.hpp index 3bb5d2eae..1c6783539 100644 --- a/apps/essimporter/converter.hpp +++ b/apps/essimporter/converter.hpp @@ -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::const_iterator it = faction.mReactions.begin(); it != faction.mReactions.end(); ++it) diff --git a/apps/essimporter/importacdt.cpp b/apps/essimporter/importacdt.cpp index 9d881515d..1602aa784 100644 --- a/apps/essimporter/importacdt.cpp +++ b/apps/essimporter/importacdt.cpp @@ -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")) diff --git a/apps/essimporter/importinventory.cpp b/apps/essimporter/importinventory.cpp index d27cd5c8c..3ec640d3d 100644 --- a/apps/essimporter/importinventory.cpp +++ b/apps/essimporter/importinventory.cpp @@ -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");