You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw/components/esm3/quickkeys.cpp

43 lines
1.0 KiB
C++

#include "quickkeys.hpp"
#include "esmwriter.hpp"
#include "esmreader.hpp"
namespace ESM
{
void QuickKeys::load(ESMReader &esm)
{
if (esm.isNextSub("KEY_"))
esm.getSubHeader(); // no longer used, because sub-record hierachies do not work properly in esmreader
while (esm.isNextSub("TYPE"))
{
int keyType;
esm.getHT(keyType);
std::string id;
id = esm.getHNString("ID__");
QuickKey key;
key.mType = keyType;
key.mId = id;
mKeys.push_back(key);
if (esm.isNextSub("KEY_"))
esm.getSubHeader(); // no longer used, because sub-record hierachies do not work properly in esmreader
}
}
void QuickKeys::save(ESMWriter &esm) const
{
for (std::vector<QuickKey>::const_iterator it = mKeys.begin(); it != mKeys.end(); ++it)
{
esm.writeHNT("TYPE", it->mType);
esm.writeHNString("ID__", it->mId);
}
}
}