From 0f5a77129225e2ff6587941dc11661b175df1f15 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 20 Aug 2020 14:47:53 +0300 Subject: [PATCH] Fix cAudioScriptObject --- src/audio/AudioScriptObject.cpp | 10 ++++++++++ src/audio/AudioScriptObject.h | 3 +++ src/audio/DMAudio.cpp | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/audio/AudioScriptObject.cpp b/src/audio/AudioScriptObject.cpp index 69d80fbc..ac30f757 100644 --- a/src/audio/AudioScriptObject.cpp +++ b/src/audio/AudioScriptObject.cpp @@ -4,6 +4,16 @@ #include "Pools.h" #include "DMAudio.h" +cAudioScriptObject::cAudioScriptObject() +{ + Reset(); +}; + +cAudioScriptObject::~cAudioScriptObject() +{ + Reset(); +}; + void cAudioScriptObject::Reset() { diff --git a/src/audio/AudioScriptObject.h b/src/audio/AudioScriptObject.h index ff36474d..8110b2bb 100644 --- a/src/audio/AudioScriptObject.h +++ b/src/audio/AudioScriptObject.h @@ -7,6 +7,9 @@ public: CVector Posn; int32 AudioEntity; + cAudioScriptObject(); + ~cAudioScriptObject(); + void Reset(); /// ok static void* operator new(size_t); diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index dd55f76d..9d278046 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -203,7 +203,7 @@ cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos) int32 cDMAudio::CreateLoopingScriptObject(cAudioScriptObject *scriptObject) { - int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, (CPhysical *)scriptObject); + int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject); if ( AEHANDLE_IS_OK(audioEntity) ) AudioManager.SetEntityStatus(audioEntity, true); @@ -220,7 +220,7 @@ cDMAudio::DestroyLoopingScriptObject(int32 audioEntity) void cDMAudio::CreateOneShotScriptObject(cAudioScriptObject *scriptObject) { - int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, (CPhysical *)scriptObject); + int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject); if ( AEHANDLE_IS_OK(audioEntity) ) {