mirror of https://github.com/OpenMW/openmw.git
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.
43 lines
1.0 KiB
C++
43 lines
1.0 KiB
C++
11 years ago
|
#include "quickkeys.hpp"
|
||
|
|
||
|
#include "esmwriter.hpp"
|
||
|
#include "esmreader.hpp"
|
||
|
|
||
|
namespace ESM
|
||
|
{
|
||
|
|
||
|
void QuickKeys::load(ESMReader &esm)
|
||
|
{
|
||
11 years ago
|
if (esm.isNextSub("KEY_"))
|
||
|
esm.getSubHeader(); // no longer used, because sub-record hierachies do not work properly in esmreader
|
||
|
|
||
|
while (esm.isNextSub("TYPE"))
|
||
11 years ago
|
{
|
||
|
int keyType;
|
||
11 years ago
|
esm.getHT(keyType);
|
||
11 years ago
|
std::string id;
|
||
|
id = esm.getHNString("ID__");
|
||
|
|
||
|
QuickKey key;
|
||
|
key.mType = keyType;
|
||
|
key.mId = id;
|
||
|
|
||
|
mKeys.push_back(key);
|
||
11 years ago
|
|
||
|
if (esm.isNextSub("KEY_"))
|
||
|
esm.getSubHeader(); // no longer used, because sub-record hierachies do not work properly in esmreader
|
||
11 years ago
|
}
|
||
|
}
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|