forked from mirror/openmw-tes3mp
Move to esm component
parent
f8cc328b5e
commit
8560b43464
@ -0,0 +1,43 @@
|
||||
#include "quickkeys.hpp"
|
||||
|
||||
#include "esmwriter.hpp"
|
||||
#include "esmreader.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
||||
void QuickKeys::load(ESMReader &esm)
|
||||
{
|
||||
while (esm.isNextSub("KEY_"))
|
||||
{
|
||||
esm.getSubHeader();
|
||||
int keyType;
|
||||
esm.getHNT(keyType, "TYPE");
|
||||
std::string id;
|
||||
id = esm.getHNString("ID__");
|
||||
|
||||
QuickKey key;
|
||||
key.mType = keyType;
|
||||
key.mId = id;
|
||||
|
||||
mKeys.push_back(key);
|
||||
}
|
||||
}
|
||||
|
||||
void QuickKeys::save(ESMWriter &esm) const
|
||||
{
|
||||
const std::string recKey = "KEY_";
|
||||
|
||||
for (std::vector<QuickKey>::const_iterator it = mKeys.begin(); it != mKeys.end(); ++it)
|
||||
{
|
||||
esm.startSubRecord(recKey);
|
||||
|
||||
esm.writeHNT("TYPE", it->mType);
|
||||
esm.writeHNString("ID__", it->mId);
|
||||
|
||||
esm.endRecord(recKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
#ifndef OPENMW_COMPONENTS_ESM_QUICKKEYS_H
|
||||
#define OPENMW_COMPONENTS_ESM_QUICKKEYS_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
class ESMReader;
|
||||
class ESMWriter;
|
||||
|
||||
struct QuickKeys
|
||||
{
|
||||
struct QuickKey
|
||||
{
|
||||
int mType;
|
||||
std::string mId; // Spell or Item ID
|
||||
};
|
||||
|
||||
std::vector<QuickKey> mKeys;
|
||||
|
||||
void load (ESMReader &esm);
|
||||
void save (ESMWriter &esm) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue