1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 21:59:55 +00:00
openmw/components/esm3/magiceffects.cpp

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

36 lines
848 B
C++
Raw Normal View History

#include "magiceffects.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
void MagicEffects::save(ESMWriter& esm) const
{
for (const auto& [key, params] : mEffects)
2022-09-22 18:26:05 +00:00
{
esm.writeHNT("EFID", key);
esm.writeHNT("BASE", params.first);
esm.writeHNT("MODI", params.second);
2022-09-22 18:26:05 +00:00
}
}
void MagicEffects::load(ESMReader& esm)
{
while (esm.isNextSub("EFID"))
2022-09-22 18:26:05 +00:00
{
2023-10-24 17:25:52 +00:00
int32_t id;
std::pair<int32_t, float> params;
esm.getHT(id);
esm.getHNT(params.first, "BASE");
if (esm.getFormatVersion() <= MaxClearModifiersFormatVersion)
params.second = 0.f;
else
esm.getHNT(params.second, "MODI");
mEffects.emplace(id, params);
2022-09-22 18:26:05 +00:00
}
}
}