1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-16 16:10:58 +00:00
OpenMW/components/esm3/effectlist.cpp
2024-02-24 14:03:24 +01:00

41 lines
837 B
C++

#include "effectlist.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
#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);
}
void EffectList::load(ESMReader& esm)
{
mList.clear();
while (esm.isNextSub("ENAM"))
{
add(esm);
}
}
void EffectList::add(ESMReader& esm)
{
ENAMstruct s;
esm.getSubComposite(s);
mList.push_back(s);
}
void EffectList::save(ESMWriter& esm) const
{
for (const ENAMstruct& enam : mList)
{
esm.writeNamedComposite("ENAM", enam);
}
}
} // end namespace