1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 10:53:54 +00:00
openmw/components/esm3/effectlist.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
837 B
C++
Raw Normal View History

2012-09-17 07:37:50 +00:00
#include "effectlist.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
2012-09-17 07:37:50 +00:00
#include <components/misc/concepts.hpp>
namespace ESM
{
template <Misc::SameAsWithoutCvref<ENAMstruct> T>
void decompose(T&& v, const auto& f)
{
f(v.mEffectID, v.mSkill, v.mAttribute, v.mRange, v.mArea, v.mDuration, v.mMagnMin, v.mMagnMax);
}
2012-09-17 07:37:50 +00:00
void EffectList::load(ESMReader& esm)
{
mList.clear();
2012-09-17 07:37:50 +00:00
while (esm.isNextSub("ENAM"))
{
add(esm);
2022-09-22 18:26:05 +00:00
}
2012-09-17 07:37:50 +00:00
}
void EffectList::add(ESMReader& esm)
{
ENAMstruct s;
esm.getSubComposite(s);
mList.push_back(s);
}
void EffectList::save(ESMWriter& esm) const
2012-09-17 07:37:50 +00:00
{
for (const ENAMstruct& enam : mList)
{
esm.writeNamedComposite("ENAM", enam);
2022-09-22 18:26:05 +00:00
}
2012-09-17 07:37:50 +00:00
}
} // end namespace