2014-05-14 23:58:44 +00:00
|
|
|
#include "doorstate.hpp"
|
|
|
|
|
|
|
|
#include "esmreader.hpp"
|
|
|
|
#include "esmwriter.hpp"
|
|
|
|
|
2019-12-21 10:35:08 +00:00
|
|
|
#include <components/debug/debuglog.hpp>
|
|
|
|
|
2014-05-14 23:58:44 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
|
|
|
|
void DoorState::load(ESMReader& esm)
|
|
|
|
{
|
|
|
|
ObjectState::load(esm);
|
|
|
|
|
|
|
|
mDoorState = 0;
|
|
|
|
esm.getHNOT(mDoorState, "ANIM");
|
2019-12-21 10:35:08 +00:00
|
|
|
if (mDoorState < 0 || mDoorState > 2)
|
2023-04-03 07:23:47 +00:00
|
|
|
Log(Debug::Warning) << "Dropping invalid door state (" << mDoorState << ") for door " << mRef.mRefID;
|
2014-05-14 23:58:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DoorState::save(ESMWriter& esm, bool inInventory) const
|
|
|
|
{
|
|
|
|
ObjectState::save(esm, inInventory);
|
|
|
|
|
2019-12-21 10:35:08 +00:00
|
|
|
if (mDoorState < 0 || mDoorState > 2)
|
|
|
|
{
|
2023-04-03 07:23:47 +00:00
|
|
|
Log(Debug::Warning) << "Dropping invalid door state (" << mDoorState << ") for door " << mRef.mRefID;
|
2019-12-21 10:35:08 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-05-14 23:58:44 +00:00
|
|
|
if (mDoorState != 0)
|
|
|
|
esm.writeHNT("ANIM", mDoorState);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|