Skip to content

Give OgreOggListener its own Movable Object Type name#48

Open
chillywillysoft wants to merge 1 commit intoOGRECave:masterfrom
chillywillysoft:MOT
Open

Give OgreOggListener its own Movable Object Type name#48
chillywillysoft wants to merge 1 commit intoOGRECave:masterfrom
chillywillysoft:MOT

Conversation

@chillywillysoft
Copy link
Contributor

OgreOggListener's override of MovableObject::getMovableType() returns the same name as OgreOggISound. One of the main reasons for getting the type is to be able to cast the pointer to a pointer to a specific derived class, which this shared name prevents. A current workaround is to compare the pointer to the singleton's listener:

	for (Ogre::MovableObject * mo : sn->getAttachedObjects())
	{
		if ((mo->getMovableType() == OgreOggSound::OgreOggSoundFactory::FACTORY_TYPE_NAME) &&
			(mo != OgreOggSound::OgreOggSoundManager::getSingleton().getListener()))
		{
			OgreOggSound::OgreOggISound * sound = static_cast<OgreOggSound::OgreOggISound *>(mo);
		}
	}

This PR gives the Listener its own name. It also changes the constants' names to the new MOT_* style. It breaks existing code so I understand if you don't want to merge this one.

…constant names.

Note that destroyAllMovableObjectsByType() does not destroy the Listener since it wasn't created through the SceneManager. It is destroyed by _destroyListener()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant