From 875df46ae93aedf78a64d49eddc0854d0b07fca2 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 27 Jan 2015 15:41:37 +0100 Subject: [PATCH] ESSImport: convert journal indices --- apps/essimporter/converter.hpp | 18 ++++++++++++++++++ components/esm/queststate.hpp | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/apps/essimporter/converter.hpp b/apps/essimporter/converter.hpp index c5ee0e3a9..95e8506bc 100644 --- a/apps/essimporter/converter.hpp +++ b/apps/essimporter/converter.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include "importcrec.hpp" #include "importcntc.hpp" @@ -431,7 +432,24 @@ public: std::string id = esm.getHNString("NAME"); DIAL dial; dial.load(esm); + if (dial.mIndex > 0) + mDials[id] = dial; } + virtual void write(ESM::ESMWriter &esm) + { + for (std::map::const_iterator it = mDials.begin(); it != mDials.end(); ++it) + { + esm.startRecord(ESM::REC_QUES); + ESM::QuestState state; + state.mFinished = 0; + state.mState = it->second.mIndex; + state.mTopic = Misc::StringUtils::lowerCase(it->first); + state.save(esm); + esm.endRecord(ESM::REC_QUES); + } + } +private: + std::map mDials; }; class ConvertQUES : public Converter diff --git a/components/esm/queststate.hpp b/components/esm/queststate.hpp index 1769336f2..4966cdc90 100644 --- a/components/esm/queststate.hpp +++ b/components/esm/queststate.hpp @@ -12,7 +12,7 @@ namespace ESM struct QuestState { - std::string mTopic; + std::string mTopic; // lower case id int mState; unsigned char mFinished; @@ -21,4 +21,4 @@ namespace ESM }; } -#endif \ No newline at end of file +#endif