From 0a87fc6860b5c2eac4d69c6e355ffc4612d92e6a Mon Sep 17 00:00:00 2001 From: Chilly Willy Date: Fri, 28 Nov 2025 10:29:58 -0800 Subject: [PATCH] OgreOggListener gets its own Movable Object Type name. Use new style constant names. Note that destroyAllMovableObjectsByType() does not destroy the Listener since it wasn't created through the SceneManager. It is destroyed by _destroyListener() --- oggsound/include/OgreOggISound.h | 2 ++ oggsound/include/OgreOggListener.h | 5 +++-- oggsound/include/OgreOggSoundFactory.h | 2 -- oggsound/src/OgreOggISound.cpp | 4 +++- oggsound/src/OgreOggListener.cpp | 4 +++- oggsound/src/OgreOggSoundFactory.cpp | 4 +--- oggsound/src/OgreOggSoundManager.cpp | 6 +++--- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/oggsound/include/OgreOggISound.h b/oggsound/include/OgreOggISound.h index 0a71a19..3edc3c6 100644 --- a/oggsound/include/OgreOggISound.h +++ b/oggsound/include/OgreOggISound.h @@ -43,6 +43,8 @@ namespace OgreOggSound { + extern const Ogre::String MOT_OGG_ISOUND; + //! Action to perform after a fade has completed. /** @remarks diff --git a/oggsound/include/OgreOggListener.h b/oggsound/include/OgreOggListener.h index 25ba64e..117e623 100644 --- a/oggsound/include/OgreOggListener.h +++ b/oggsound/include/OgreOggListener.h @@ -37,6 +37,8 @@ namespace OgreOggSound { + extern const Ogre::String MOT_OGG_LISTENER; + //! Listener object (Users ears) /** Handles properties associated with the listener. */ @@ -91,8 +93,7 @@ namespace OgreOggSound void update(); /** Gets the movable type string for this object. @remarks - Overridden function from MovableObject, returns a - Sound object string for identification. + Overridden function from MovableObject. */ const Ogre::String& getMovableType(void) const override; /** Gets the bounding box of this object. diff --git a/oggsound/include/OgreOggSoundFactory.h b/oggsound/include/OgreOggSoundFactory.h index 0ef0a07..1beca2a 100644 --- a/oggsound/include/OgreOggSoundFactory.h +++ b/oggsound/include/OgreOggSoundFactory.h @@ -51,8 +51,6 @@ namespace OgreOggSound OgreOggSoundFactory() {} ~OgreOggSoundFactory() {} - static const Ogre::String FACTORY_TYPE_NAME; - const Ogre::String& getType(void) const; #if AV_OGRE_NEXT_VERSION >= 0x20000 diff --git a/oggsound/src/OgreOggISound.cpp b/oggsound/src/OgreOggISound.cpp index 2d27fbe..d671474 100644 --- a/oggsound/src/OgreOggISound.cpp +++ b/oggsound/src/OgreOggISound.cpp @@ -694,9 +694,11 @@ namespace OgreOggSound _updateFade(fTime); } /*/////////////////////////////////////////////////////////////////*/ + const Ogre::String MOT_OGG_ISOUND = "OgreOggISound"; + /*/////////////////////////////////////////////////////////////////*/ const Ogre::String& OgreOggISound::getMovableType(void) const { - return OgreOggSoundFactory::FACTORY_TYPE_NAME; + return MOT_OGG_ISOUND; } /*/////////////////////////////////////////////////////////////////*/ const Ogre::AxisAlignedBox& OgreOggISound::getBoundingBox(void) const diff --git a/oggsound/src/OgreOggListener.cpp b/oggsound/src/OgreOggListener.cpp index 3fa8f25..d4b1288 100644 --- a/oggsound/src/OgreOggListener.cpp +++ b/oggsound/src/OgreOggListener.cpp @@ -104,9 +104,11 @@ namespace OgreOggSound return 0; } /*/////////////////////////////////////////////////////////////////*/ + const Ogre::String MOT_OGG_LISTENER = "OgreOggListener"; + /*/////////////////////////////////////////////////////////////////*/ const Ogre::String& OgreOggListener::getMovableType(void) const { - return OgreOggSoundFactory::FACTORY_TYPE_NAME; + return MOT_OGG_LISTENER; } /*/////////////////////////////////////////////////////////////////*/ void OgreOggListener::_notifyAttached( diff --git a/oggsound/src/OgreOggSoundFactory.cpp b/oggsound/src/OgreOggSoundFactory.cpp index d5dacfa..54ea0f0 100644 --- a/oggsound/src/OgreOggSoundFactory.cpp +++ b/oggsound/src/OgreOggSoundFactory.cpp @@ -35,12 +35,10 @@ namespace OgreOggSound { - const Ogre::String OgreOggSoundFactory::FACTORY_TYPE_NAME = "OgreOggISound"; - //----------------------------------------------------------------------- const Ogre::String& OgreOggSoundFactory::getType(void) const { - return FACTORY_TYPE_NAME; + return MOT_OGG_ISOUND; } //----------------------------------------------------------------------- #if AV_OGRE_NEXT_VERSION >= 0x20100 diff --git a/oggsound/src/OgreOggSoundManager.cpp b/oggsound/src/OgreOggSoundManager.cpp index 2a1b7f7..6eba990 100644 --- a/oggsound/src/OgreOggSoundManager.cpp +++ b/oggsound/src/OgreOggSoundManager.cpp @@ -215,7 +215,7 @@ namespace OgreOggSound #endif { Ogre::SceneManager* s = mListener->getSceneManager(); - s->destroyAllMovableObjectsByType(OgreOggSoundFactory::FACTORY_TYPE_NAME); + s->destroyAllMovableObjectsByType(MOT_OGG_ISOUND); } _destroyListener(); } @@ -525,9 +525,9 @@ namespace OgreOggSound { sound = static_cast( #if AV_OGRE_NEXT_VERSION >= 0x20000 - scnMgr->createMovableObject( OgreOggSoundFactory::FACTORY_TYPE_NAME, &(scnMgr->_getEntityMemoryManager(Ogre::SCENE_DYNAMIC)), ¶ms ) + scnMgr->createMovableObject( MOT_OGG_ISOUND, &(scnMgr->_getEntityMemoryManager(Ogre::SCENE_DYNAMIC)), ¶ms ) #else - scnMgr->createMovableObject( name, OgreOggSoundFactory::FACTORY_TYPE_NAME, ¶ms ) + scnMgr->createMovableObject( name, MOT_OGG_ISOUND, ¶ms ) #endif ); }