mirror of https://github.com/OpenMW/openmw.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
848 B
C++
36 lines
848 B
C++
#include "magiceffects.hpp"
|
|
|
|
#include "esmreader.hpp"
|
|
#include "esmwriter.hpp"
|
|
|
|
namespace ESM
|
|
{
|
|
|
|
void MagicEffects::save(ESMWriter& esm) const
|
|
{
|
|
for (const auto& [key, params] : mEffects)
|
|
{
|
|
esm.writeHNT("EFID", key);
|
|
esm.writeHNT("BASE", params.first);
|
|
esm.writeHNT("MODI", params.second);
|
|
}
|
|
}
|
|
|
|
void MagicEffects::load(ESMReader& esm)
|
|
{
|
|
while (esm.isNextSub("EFID"))
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
|
|
}
|