Activate/OnActivate fix (Bug #3712)

coverity_scan^2
scrawl 8 years ago
parent 73aa07b81b
commit 69ce9f32bc

@ -13,7 +13,8 @@ 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
Flag_OnActivate = 2,
Flag_ActivationBuffered = 4
};
}
@ -241,38 +242,32 @@ namespace MWWorld
return mChanged || !mAnimationState.empty();
}
bool RefData::activateByScript()
{
bool ret = (mFlags & Flag_ActivationBuffered);
mFlags &= ~(Flag_SuppressActivate|Flag_OnActivate);
return ret;
}
bool RefData::activate()
{
if (!(mFlags & Flag_SuppressActivate))
return true;
else
if (mFlags & Flag_SuppressActivate)
{
mFlags |= Flag_OnActivate;
mFlags |= Flag_OnActivate|Flag_ActivationBuffered;
return false;
}
}
bool RefData::onActivate()
{
mFlags |= Flag_SuppressActivate;
if (mFlags & Flag_OnActivate)
else
{
mFlags &= (~Flag_OnActivate);
return true;
}
return false;
}
bool RefData::activateByScript()
bool RefData::onActivate()
{
if (mFlags & Flag_SuppressActivate)
{
mFlags &= (~Flag_SuppressActivate);
return true;
}
else
return false;
bool ret = mFlags & Flag_OnActivate;
mFlags |= Flag_SuppressActivate;
mFlags &= (~Flag_OnActivate);
return ret;
}
const ESM::AnimationState& RefData::getAnimationState() const

Loading…
Cancel
Save