diff --git a/apps/essimporter/converter.hpp b/apps/essimporter/converter.hpp index c5ee0e3a92..95e8506bcd 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 1769336f2f..4966cdc908 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