1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-28 18:18:52 +00:00
OpenMW/components/esm3/spelllist.cpp
elsid 6d261d38dd
Add functions to read and write ESM::RefId and use them
To be later changed with another implementation.
2023-02-13 22:07:58 +01:00

33 lines
645 B
C++

#include "spelllist.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
#include <components/misc/strings/algorithm.hpp>
namespace ESM
{
void SpellList::add(ESMReader& esm)
{
mList.push_back(esm.getRefId());
}
void SpellList::save(ESMWriter& esm) const
{
for (auto it = mList.begin(); it != mList.end(); ++it)
{
esm.writeHNRefId("NPCS", *it, 32);
}
}
bool SpellList::exists(const ESM::RefId& spell) const
{
for (auto it = mList.begin(); it != mList.end(); ++it)
if (*it == spell)
return true;
return false;
}
}