[PATCH] Ogre 1.8 compability

scrawl

16-12-2011 18:01:34

I've made a patch to make OgreAL build against the latest ogre 1.8 trunk (singleton name changes)

(I can't attach a file (really, forum admins :?: neither .patch, .diff, .txt are allowed :?: ))


Index: src/OgreALSoundManager.cpp
===================================================================
--- src/OgreALSoundManager.cpp (revision 137)
+++ src/OgreALSoundManager.cpp (working copy)
@@ -36,7 +36,11 @@
#include "OgreALException.h"
#include "OgreALSoundManager.h"

-template<> OgreAL::SoundManager* Ogre::Singleton<OgreAL::SoundManager>::ms_Singleton = 0;
+#if (OGRE_VERSION < ((1 << 16) | (8 << 8)))
+ template<> OgreAL::SoundManager* Ogre::Singleton<OgreAL::SoundManager>::ms_Singleton = 0;
+#else
+ template<> OgreAL::SoundManager* Ogre::Singleton<OgreAL::SoundManager>::msSingleton = 0;
+#endif

#if OGREAL_THREADED
boost::thread *OgreAL::SoundManager::mOgreALThread = 0;
@@ -147,6 +151,7 @@
alcCloseDevice(mDevice);
}

+#if (OGRE_VERSION < ((1 << 16) | (8 << 8)))
SoundManager* SoundManager::getSingletonPtr(void)
{
return ms_Singleton;
@@ -156,7 +161,18 @@
{
assert( ms_Singleton ); return (*ms_Singleton);
}
+#else
+ SoundManager* SoundManager::getSingletonPtr(void)
+ {
+ return msSingleton;
+ }

+ SoundManager& SoundManager::getSingleton(void)
+ {
+ assert( msSingleton ); return (*msSingleton);
+ }
+#endif
+
Sound* SoundManager::createSound(const Ogre::String& name,
const Ogre::String& fileName, bool loop, bool stream)
{
Index: src/OgreALListener.cpp
===================================================================
--- src/OgreALListener.cpp (revision 137)
+++ src/OgreALListener.cpp (working copy)
@@ -36,7 +36,11 @@
#include "OgreALException.h"
#include "OgreALListener.h"

-template<> OgreAL::Listener* Ogre::Singleton<OgreAL::Listener>::ms_Singleton = 0;
+#if (OGRE_VERSION < ((1 << 16) | (8 << 8)))
+ template<> OgreAL::Listener* Ogre::Singleton<OgreAL::Listener>::ms_Singleton = 0;
+#else
+ template<> OgreAL::Listener* Ogre::Singleton<OgreAL::Listener>::msSingleton = 0;
+#endif

namespace OgreAL {
Listener::Listener() :
@@ -70,6 +74,7 @@
Listener::~Listener()
{}

+#if (OGRE_VERSION < ((1 << 16) | (8 << 8)))
Listener* Listener::getSingletonPtr(void)
{
return ms_Singleton;
@@ -79,7 +84,18 @@
{
assert(ms_Singleton); return (*ms_Singleton);
}
+#else
+ Listener* Listener::getSingletonPtr(void)
+ {
+ return msSingleton;
+ }

+ Listener& Listener::getSingleton(void)
+ {
+ assert(msSingleton); return (*msSingleton);
+ }
+#endif
+
void Listener::setGain(Ogre::Real gain)
{
mGain = gain;