snd_StrmSoundHandle OK

This commit is contained in:
robojumper
2025-05-27 22:10:58 +02:00
parent 5797f4cf8a
commit 8f7362eb4d
3 changed files with 28 additions and 1 deletions
+25
View File
@@ -11,7 +11,9 @@
#include "common.h" // nullptr
#include "nw4r/snd/snd_SoundHandle.h"
#include "nw4r/snd/snd_StrmSound.h"
#include "nw4r/ut/ut_RuntimeTypeInfo.h"
/*******************************************************************************
* functions
@@ -19,6 +21,29 @@
namespace nw4r { namespace snd {
StrmSoundHandle::StrmSoundHandle(SoundHandle* handle)
: mSound(nullptr)
{
if (!handle)
return;
detail::BasicSound *basicSound = handle->detail_GetAttachedSound();
if (!basicSound)
return;
if (detail::StrmSound *sound =
ut::DynamicCast<detail::StrmSound *>(basicSound))
{
mSound = sound;
if (mSound->IsAttachedTempSpecialHandle())
mSound->DetachTempSpecialHandle();
mSound->mTempSpecialHandle = this;
}
}
void StrmSoundHandle::DetachSound()
{
if (IsAttachedSound())