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.
openmw/components/esm3/doorstate.cpp

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);
}
}