1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-28 18:18:52 +00:00
OpenMW/components/esm3/doorstate.cpp
2023-04-03 11:28:03 +04:00

36 lines
850 B
C++

#include "doorstate.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
#include <components/debug/debuglog.hpp>
namespace ESM
{
void DoorState::load(ESMReader& esm)
{
ObjectState::load(esm);
mDoorState = 0;
esm.getHNOT(mDoorState, "ANIM");
if (mDoorState < 0 || mDoorState > 2)
Log(Debug::Warning) << "Dropping invalid door state (" << mDoorState << ") for door " << mRef.mRefID;
}
void DoorState::save(ESMWriter& esm, bool inInventory) const
{
ObjectState::save(esm, inInventory);
if (mDoorState < 0 || mDoorState > 2)
{
Log(Debug::Warning) << "Dropping invalid door state (" << mDoorState << ") for door " << mRef.mRefID;
return;
}
if (mDoorState != 0)
esm.writeHNT("ANIM", mDoorState);
}
}