|
|
|
@ -8,8 +8,18 @@
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
|
{
|
|
|
|
|
enum RefDataFlags
|
|
|
|
|
{
|
|
|
|
|
Flag_SuppressActivate = 1, // If set, activation will be suppressed and redirected to the OnActivate flag, which can then be handled by a script.
|
|
|
|
|
Flag_OnActivate = 2
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace MWWorld
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
void RefData::copy (const RefData& refData)
|
|
|
|
|
{
|
|
|
|
|
mBaseNode = refData.mBaseNode;
|
|
|
|
@ -19,6 +29,7 @@ namespace MWWorld
|
|
|
|
|
mPosition = refData.mPosition;
|
|
|
|
|
mChanged = refData.mChanged;
|
|
|
|
|
mDeletedByContentFile = refData.mDeletedByContentFile;
|
|
|
|
|
mFlags = refData.mFlags;
|
|
|
|
|
|
|
|
|
|
mCustomData = refData.mCustomData ? refData.mCustomData->clone() : 0;
|
|
|
|
|
}
|
|
|
|
@ -32,7 +43,7 @@ namespace MWWorld
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RefData::RefData()
|
|
|
|
|
: mBaseNode(0), mDeletedByContentFile(false), mEnabled (true), mCount (1), mCustomData (0), mChanged(false)
|
|
|
|
|
: mBaseNode(0), mDeletedByContentFile(false), mEnabled (true), mCount (1), mCustomData (0), mChanged(false), mFlags(0)
|
|
|
|
|
{
|
|
|
|
|
for (int i=0; i<3; ++i)
|
|
|
|
|
{
|
|
|
|
@ -45,7 +56,7 @@ namespace MWWorld
|
|
|
|
|
: mBaseNode(0), mDeletedByContentFile(false), mEnabled (true),
|
|
|
|
|
mCount (1), mPosition (cellRef.mPos),
|
|
|
|
|
mCustomData (0),
|
|
|
|
|
mChanged(false) // Loading from ESM/ESP files -> assume unchanged
|
|
|
|
|
mChanged(false), mFlags(0) // Loading from ESM/ESP files -> assume unchanged
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -55,8 +66,12 @@ namespace MWWorld
|
|
|
|
|
mCount (objectState.mCount),
|
|
|
|
|
mPosition (objectState.mPosition),
|
|
|
|
|
mCustomData (0),
|
|
|
|
|
mChanged(true) // Loading from a savegame -> assume changed
|
|
|
|
|
mChanged(true), mFlags(objectState.mFlags) // Loading from a savegame -> assume changed
|
|
|
|
|
{
|
|
|
|
|
// "Note that the ActivationFlag_UseEnabled is saved to the reference,
|
|
|
|
|
// which will result in permanently suppressed activation if the reference script is removed.
|
|
|
|
|
// This occurred when removing the animated containers mod, and the fix in MCP is to reset UseEnabled to true on loading a game."
|
|
|
|
|
mFlags &= (~Flag_SuppressActivate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RefData::RefData (const RefData& refData)
|
|
|
|
@ -80,6 +95,7 @@ namespace MWWorld
|
|
|
|
|
objectState.mEnabled = mEnabled;
|
|
|
|
|
objectState.mCount = mCount;
|
|
|
|
|
objectState.mPosition = mPosition;
|
|
|
|
|
objectState.mFlags = mFlags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RefData& RefData::operator= (const RefData& refData)
|
|
|
|
@ -219,4 +235,38 @@ namespace MWWorld
|
|
|
|
|
{
|
|
|
|
|
return mChanged;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RefData::activate()
|
|
|
|
|
{
|
|
|
|
|
if (!(mFlags & Flag_SuppressActivate))
|
|
|
|
|
return true;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mFlags |= Flag_OnActivate;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RefData::onActivate()
|
|
|
|
|
{
|
|
|
|
|
mFlags |= Flag_SuppressActivate;
|
|
|
|
|
|
|
|
|
|
if (mFlags & Flag_OnActivate)
|
|
|
|
|
{
|
|
|
|
|
mFlags &= (~Flag_OnActivate);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RefData::activateByScript()
|
|
|
|
|
{
|
|
|
|
|
if (mFlags & Flag_SuppressActivate)
|
|
|
|
|
{
|
|
|
|
|
mFlags &= (~Flag_SuppressActivate);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|