diff --git a/apps/openmw/mwworld/refdata.cpp b/apps/openmw/mwworld/refdata.cpp index de26d1292..ae36db1c3 100644 --- a/apps/openmw/mwworld/refdata.cpp +++ b/apps/openmw/mwworld/refdata.cpp @@ -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