2010-07-03 13:41:20 +00:00
|
|
|
#ifndef GAME_MWWORLD_REFDATA_H
|
|
|
|
#define GAME_MWWORLD_REFDATA_H
|
2010-07-02 11:48:48 +00:00
|
|
|
|
2012-01-27 13:55:58 +00:00
|
|
|
#include <components/esm/defs.hpp>
|
2016-07-30 17:24:03 +00:00
|
|
|
#include <components/esm/animationstate.hpp>
|
2010-07-02 12:31:29 +00:00
|
|
|
|
2012-01-27 13:55:58 +00:00
|
|
|
#include "../mwscript/locals.hpp"
|
2010-08-04 12:37:23 +00:00
|
|
|
|
2016-01-25 13:13:16 +00:00
|
|
|
#include <string>
|
2015-04-19 15:55:56 +00:00
|
|
|
|
2015-11-20 20:57:04 +00:00
|
|
|
namespace SceneUtil
|
2015-04-12 13:34:50 +00:00
|
|
|
{
|
|
|
|
class PositionAttitudeTransform;
|
|
|
|
}
|
|
|
|
|
2010-07-02 12:31:29 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
class Script;
|
2012-01-27 13:55:58 +00:00
|
|
|
class CellRef;
|
2014-02-02 22:59:57 +00:00
|
|
|
struct ObjectState;
|
2010-07-02 12:31:29 +00:00
|
|
|
}
|
|
|
|
|
2010-07-03 13:41:20 +00:00
|
|
|
namespace MWWorld
|
2010-07-02 11:48:48 +00:00
|
|
|
{
|
2013-04-16 19:17:19 +00:00
|
|
|
|
2012-01-24 10:23:22 +00:00
|
|
|
class CustomData;
|
|
|
|
|
2010-07-02 12:31:29 +00:00
|
|
|
class RefData
|
2010-07-02 11:48:48 +00:00
|
|
|
{
|
2015-11-20 20:57:04 +00:00
|
|
|
SceneUtil::PositionAttitudeTransform* mBaseNode;
|
2010-08-04 12:04:22 +00:00
|
|
|
|
2015-09-15 11:58:07 +00:00
|
|
|
MWScript::Locals mLocals;
|
|
|
|
|
2015-12-12 21:33:14 +00:00
|
|
|
/// separate delete flag used for deletion by a content file
|
|
|
|
/// @note not stored in the save game file.
|
2015-12-12 21:37:23 +00:00
|
|
|
bool mDeletedByContentFile;
|
2015-12-12 21:33:14 +00:00
|
|
|
|
2010-07-09 14:07:03 +00:00
|
|
|
bool mEnabled;
|
2010-08-04 12:04:22 +00:00
|
|
|
|
2015-12-12 21:33:14 +00:00
|
|
|
/// 0: deleted
|
|
|
|
int mCount;
|
2014-12-01 21:10:06 +00:00
|
|
|
|
2012-01-22 10:20:05 +00:00
|
|
|
ESM::Position mPosition;
|
|
|
|
|
2016-07-30 17:24:03 +00:00
|
|
|
ESM::AnimationState mAnimationState;
|
|
|
|
|
2012-01-24 10:23:22 +00:00
|
|
|
CustomData *mCustomData;
|
|
|
|
|
2012-01-22 10:20:05 +00:00
|
|
|
void copy (const RefData& refData);
|
|
|
|
|
|
|
|
void cleanup();
|
2010-08-04 12:04:22 +00:00
|
|
|
|
2014-05-25 12:13:07 +00:00
|
|
|
bool mChanged;
|
|
|
|
|
2016-02-26 11:59:35 +00:00
|
|
|
unsigned int mFlags;
|
|
|
|
|
2011-11-08 00:08:00 +00:00
|
|
|
public:
|
2012-01-22 10:00:40 +00:00
|
|
|
|
2013-12-05 11:49:25 +00:00
|
|
|
RefData();
|
|
|
|
|
2012-01-22 10:00:40 +00:00
|
|
|
/// @param cellRef Used to copy constant data such as position into this class where it can
|
2014-06-24 16:37:38 +00:00
|
|
|
/// be altered without affecting the original data. This makes it possible
|
2015-12-12 21:33:14 +00:00
|
|
|
/// to reset the position as the original data is still held in the CellRef
|
2012-01-27 13:55:58 +00:00
|
|
|
RefData (const ESM::CellRef& cellRef);
|
2012-01-22 10:00:40 +00:00
|
|
|
|
2015-12-12 21:37:23 +00:00
|
|
|
RefData (const ESM::ObjectState& objectState, bool deletedByContentFile);
|
2014-01-16 11:03:23 +00:00
|
|
|
///< Ignores local variables and custom data (not enough context available here to
|
|
|
|
/// perform these operations).
|
|
|
|
|
2012-01-22 10:20:05 +00:00
|
|
|
RefData (const RefData& refData);
|
|
|
|
|
|
|
|
~RefData();
|
|
|
|
|
2014-03-22 14:00:49 +00:00
|
|
|
void write (ESM::ObjectState& objectState, const std::string& scriptId = "") const;
|
|
|
|
///< Ignores custom data (not enough context available here to
|
|
|
|
/// perform this operations).
|
2014-01-16 11:03:23 +00:00
|
|
|
|
2012-01-22 10:20:05 +00:00
|
|
|
RefData& operator= (const RefData& refData);
|
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
/// Return base node (can be a null pointer).
|
2015-11-20 20:57:04 +00:00
|
|
|
SceneUtil::PositionAttitudeTransform* getBaseNode();
|
2012-01-22 10:00:40 +00:00
|
|
|
|
2015-12-18 17:02:57 +00:00
|
|
|
/// Return base node (can be a null pointer).
|
|
|
|
const SceneUtil::PositionAttitudeTransform* getBaseNode() const;
|
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
/// Set base node (can be a null pointer).
|
2015-11-20 20:57:04 +00:00
|
|
|
void setBaseNode (SceneUtil::PositionAttitudeTransform* base);
|
2012-01-22 10:00:40 +00:00
|
|
|
|
2020-10-13 15:46:32 +00:00
|
|
|
int getCount(bool absolute = true) const;
|
2012-01-22 10:00:40 +00:00
|
|
|
|
|
|
|
void setLocals (const ESM::Script& script);
|
|
|
|
|
|
|
|
void setCount (int count);
|
2014-12-01 21:10:06 +00:00
|
|
|
///< Set object count (an object pile is a simple object with a count >1).
|
2013-11-02 12:06:15 +00:00
|
|
|
///
|
|
|
|
/// \warning Do not call setCount() to add or remove objects from a
|
|
|
|
/// container or an actor's inventory. Call ContainerStore::add() or
|
|
|
|
/// ContainerStore::remove() instead.
|
2012-01-22 10:00:40 +00:00
|
|
|
|
2014-12-01 21:10:06 +00:00
|
|
|
/// This flag is only used for content stack loading and will not be stored in the savegame.
|
|
|
|
/// If the object was deleted by gameplay, then use setCount(0) instead.
|
2015-12-12 21:37:23 +00:00
|
|
|
void setDeletedByContentFile(bool deleted);
|
2014-12-01 21:10:06 +00:00
|
|
|
|
|
|
|
/// Returns true if the object was either deleted by the content file or by gameplay.
|
|
|
|
bool isDeleted() const;
|
2014-12-06 20:08:18 +00:00
|
|
|
/// Returns true if the object was deleted by a content file.
|
|
|
|
bool isDeletedByContentFile() const;
|
2014-12-01 21:10:06 +00:00
|
|
|
|
2012-01-22 10:00:40 +00:00
|
|
|
MWScript::Locals& getLocals();
|
|
|
|
|
|
|
|
bool isEnabled() const;
|
|
|
|
|
|
|
|
void enable();
|
|
|
|
|
|
|
|
void disable();
|
|
|
|
|
2014-06-14 15:56:41 +00:00
|
|
|
void setPosition (const ESM::Position& pos);
|
2015-12-07 02:51:03 +00:00
|
|
|
const ESM::Position& getPosition() const;
|
2012-01-24 10:23:22 +00:00
|
|
|
|
|
|
|
void setCustomData (CustomData *data);
|
2014-06-15 13:58:01 +00:00
|
|
|
///< Set custom data (potentially replacing old custom data). The ownership of \a data is
|
2012-01-24 10:23:22 +00:00
|
|
|
/// transferred to this.
|
|
|
|
|
|
|
|
CustomData *getCustomData();
|
|
|
|
///< May return a 0-pointer. The ownership of the return data object is not transferred.
|
2014-05-25 12:13:07 +00:00
|
|
|
|
2015-12-17 23:18:06 +00:00
|
|
|
const CustomData *getCustomData() const;
|
|
|
|
|
2016-02-26 11:59:35 +00:00
|
|
|
bool activate();
|
|
|
|
|
|
|
|
bool onActivate();
|
|
|
|
|
|
|
|
bool activateByScript();
|
|
|
|
|
2014-05-25 12:13:07 +00:00
|
|
|
bool hasChanged() const;
|
|
|
|
///< Has this RefData changed since it was originally loaded?
|
2016-07-30 17:24:03 +00:00
|
|
|
|
|
|
|
const ESM::AnimationState& getAnimationState() const;
|
|
|
|
ESM::AnimationState& getAnimationState();
|
2010-08-04 12:04:22 +00:00
|
|
|
};
|
2010-07-02 11:48:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|