ESSImport: convert journal indices

openmw-35
scrawl 10 years ago
parent 6367b4dc0b
commit 875df46ae9

@ -15,6 +15,7 @@
#include <components/esm/loadcrea.hpp> #include <components/esm/loadcrea.hpp>
#include <components/esm/weatherstate.hpp> #include <components/esm/weatherstate.hpp>
#include <components/esm/globalscript.hpp> #include <components/esm/globalscript.hpp>
#include <components/esm/queststate.hpp>
#include "importcrec.hpp" #include "importcrec.hpp"
#include "importcntc.hpp" #include "importcntc.hpp"
@ -431,7 +432,24 @@ public:
std::string id = esm.getHNString("NAME"); std::string id = esm.getHNString("NAME");
DIAL dial; DIAL dial;
dial.load(esm); dial.load(esm);
if (dial.mIndex > 0)
mDials[id] = dial;
} }
virtual void write(ESM::ESMWriter &esm)
{
for (std::map<std::string, DIAL>::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<std::string, DIAL> mDials;
}; };
class ConvertQUES : public Converter class ConvertQUES : public Converter

@ -12,7 +12,7 @@ namespace ESM
struct QuestState struct QuestState
{ {
std::string mTopic; std::string mTopic; // lower case id
int mState; int mState;
unsigned char mFinished; unsigned char mFinished;
@ -21,4 +21,4 @@ namespace ESM
}; };
} }
#endif #endif

Loading…
Cancel
Save