1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-01-13 07:30:56 +00:00
openmw/components/esm3/creaturelevliststate.cpp
2025-12-26 11:07:31 +01:00

36 lines
865 B
C++

#include "creaturelevliststate.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
void CreatureLevListState::load(ESMReader& esm)
{
ObjectState::load(esm);
if (esm.getFormatVersion() <= MaxActorIdSaveGameFormatVersion)
{
mSpawnedActor.mIndex = static_cast<uint32_t>(-1);
esm.getHNOT(mSpawnedActor.mIndex, "SPAW");
}
else if (esm.peekNextSub("SPAW"))
mSpawnedActor = esm.getFormId(true, "SPAW");
mSpawn = false;
esm.getHNOT(mSpawn, "RESP");
}
void CreatureLevListState::save(ESMWriter& esm, bool inInventory) const
{
ObjectState::save(esm, inInventory);
if (mSpawnedActor.isSet())
esm.writeFormId(mSpawnedActor, true, "SPAW");
if (mSpawn)
esm.writeHNT("RESP", mSpawn);
}
}