2012-09-17 11:37:50 +04:00
|
|
|
#include "effectlist.hpp"
|
|
|
|
|
2012-09-23 22:41:41 +04:00
|
|
|
#include "esmreader.hpp"
|
|
|
|
#include "esmwriter.hpp"
|
2012-09-17 11:37:50 +04:00
|
|
|
|
2024-02-24 14:03:24 +01:00
|
|
|
#include <components/misc/concepts.hpp>
|
|
|
|
|
2022-04-12 00:18:39 +02:00
|
|
|
namespace ESM
|
|
|
|
{
|
2024-02-24 14:03:24 +01:00
|
|
|
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 11:37:50 +04:00
|
|
|
|
|
|
|
void EffectList::load(ESMReader& esm)
|
|
|
|
{
|
2014-09-20 13:32:32 +02:00
|
|
|
mList.clear();
|
2012-09-17 11:37:50 +04:00
|
|
|
while (esm.isNextSub("ENAM"))
|
|
|
|
{
|
2015-02-12 04:56:05 +01:00
|
|
|
add(esm);
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-09-17 11:37:50 +04:00
|
|
|
}
|
|
|
|
|
2015-02-12 04:56:05 +01:00
|
|
|
void EffectList::add(ESMReader& esm)
|
|
|
|
{
|
|
|
|
ENAMstruct s;
|
2024-02-24 14:03:24 +01:00
|
|
|
esm.getSubComposite(s);
|
2015-02-12 04:56:05 +01:00
|
|
|
mList.push_back(s);
|
|
|
|
}
|
|
|
|
|
2013-09-16 12:32:35 +02:00
|
|
|
void EffectList::save(ESMWriter& esm) const
|
2012-09-17 11:37:50 +04:00
|
|
|
{
|
2024-02-24 14:03:24 +01:00
|
|
|
for (const ENAMstruct& enam : mList)
|
2013-09-16 12:32:35 +02:00
|
|
|
{
|
2024-02-24 14:03:24 +01:00
|
|
|
esm.writeNamedComposite("ENAM", enam);
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2012-09-17 11:37:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
} // end namespace
|