1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-29 03:19:44 +00:00
OpenMW/components/esm3/doorstate.cpp

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

36 lines
850 B
C++
Raw Normal View History

#include "doorstate.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
2019-12-21 10:35:08 +00:00
#include <components/debug/debuglog.hpp>
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;
}
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;
}
if (mDoorState != 0)
esm.writeHNT("ANIM", mDoorState);
}
}