2014-05-02 10:47:28 +00:00
|
|
|
#include "quickkeys.hpp"
|
|
|
|
|
|
|
|
#include "esmreader.hpp"
|
|
|
|
#include "esmwriter.hpp"
|
|
|
|
|
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
|
|
|
|
void QuickKeys::load(ESMReader& esm)
|
|
|
|
{
|
2014-05-12 19:04:02 +00:00
|
|
|
if (esm.isNextSub("KEY_"))
|
|
|
|
esm.getSubHeader(); // no longer used, because sub-record hierachies do not work properly in esmreader
|
|
|
|
|
|
|
|
while (esm.isNextSub("TYPE"))
|
2014-05-02 10:47:28 +00:00
|
|
|
{
|
|
|
|
int keyType;
|
2014-05-12 19:04:02 +00:00
|
|
|
esm.getHT(keyType);
|
2014-05-02 10:47:28 +00:00
|
|
|
|
|
|
|
QuickKey key;
|
|
|
|
key.mType = keyType;
|
2023-03-21 19:44:42 +00:00
|
|
|
key.mId = esm.getHNRefId("ID__");
|
2014-05-02 10:47:28 +00:00
|
|
|
|
|
|
|
mKeys.push_back(key);
|
2014-05-12 19:04:02 +00:00
|
|
|
|
|
|
|
if (esm.isNextSub("KEY_"))
|
|
|
|
esm.getSubHeader(); // no longer used, because sub-record hierachies do not work properly in esmreader
|
2014-05-02 10:47:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void QuickKeys::save(ESMWriter& esm) const
|
|
|
|
{
|
|
|
|
for (std::vector<QuickKey>::const_iterator it = mKeys.begin(); it != mKeys.end(); ++it)
|
|
|
|
{
|
|
|
|
esm.writeHNT("TYPE", it->mType);
|
2023-02-12 18:36:56 +00:00
|
|
|
esm.writeHNRefId("ID__", it->mId);
|
2014-05-02 10:47:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|