1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:29:55 +00:00
openmw/components/esm3/objectstate.hpp

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

82 lines
2 KiB
C++
Raw Normal View History

#ifndef OPENMW_ESM_OBJECTSTATE_H
#define OPENMW_ESM_OBJECTSTATE_H
#include <string>
#include <vector>
#include <components/esm/luascripts.hpp>
#include <components/esm/position.hpp>
#include <components/esm3/formatversion.hpp>
#include "animationstate.hpp"
#include "cellref.hpp"
#include "locals.hpp"
namespace ESM
{
class ESMReader;
class ESMWriter;
struct ContainerState;
struct CreatureLevListState;
struct CreatureState;
struct DoorState;
struct NpcState;
// format 0, saved games only
///< \brief Save state for objects, that do not use custom data
struct ObjectState
{
CellRef mRef;
unsigned char mHasLocals;
Locals mLocals;
LuaScripts mLuaScripts;
unsigned char mEnabled;
Position mPosition;
2023-10-24 17:25:52 +00:00
uint32_t mFlags;
// Is there any class-specific state following the ObjectState
bool mHasCustomState;
FormatVersion mVersion = DefaultFormatVersion;
2015-06-30 01:58:23 +00:00
AnimationState mAnimationState;
ObjectState()
: mHasLocals(0)
, mEnabled(0)
, mFlags(0)
, mHasCustomState(true)
{
}
/// @note Does not load the CellRef ID, it should already be loaded before calling this method
2014-01-28 12:53:24 +00:00
virtual void load(ESMReader& esm);
2014-01-28 12:53:24 +00:00
virtual void save(ESMWriter& esm, bool inInventory = false) const;
2023-02-03 20:29:26 +00:00
/// Initialize to default state
virtual void blank();
2014-01-28 12:53:24 +00:00
virtual ~ObjectState();
virtual const NpcState& asNpcState() const;
virtual NpcState& asNpcState();
virtual const CreatureState& asCreatureState() const;
virtual CreatureState& asCreatureState();
virtual const ContainerState& asContainerState() const;
virtual ContainerState& asContainerState();
virtual const DoorState& asDoorState() const;
virtual DoorState& asDoorState();
virtual const CreatureLevListState& asCreatureLevListState() const;
virtual CreatureLevListState& asCreatureLevListState();
};
}
#endif