]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Sound.cc
bugfix: resource file searching was broken
[chaz/yoink] / src / Moof / Sound.cc
index c78b35c613b972d919b51de87db0c4cbc215d503..ffa270e9e9876768669cd7ca3bdf850d46b5b09c 100644 (file)
@@ -75,12 +75,14 @@ public:
                                mOggStream.datasource = 0;
                        }
 
-                       std::string path = Sound::getPath(name);
-                       int result = ov_fopen((char*)path.c_str(), &mOggStream);
+                       std::string path(name);
+                       if (!Sound::getPath(path))
+                       {
+                               Error(Error::RESOURCE_NOT_FOUND, path).raise();
+                       }
 
-                       if (result < 0)
+                       if (ov_fopen((char*)path.c_str(), &mOggStream) < 0)
                        {
-                               logWarning << "couldn't load sound: " << path << std::endl;
                                Error(Error::UNKNOWN_AUDIO_FORMAT, path).raise();
                        }
 
@@ -572,19 +574,9 @@ void Sound::setListenerOrientation(const Vector3& forward,
 }
 
 
-std::string Sound::getPath(const std::string& name)
+bool Sound::getPath(std::string& name)
 {
-       if (boost::find_last(name, ".ogg"))
-       {
-               return Resource::getPath(name);
-       }
-       else
-       {
-               std::string path("sounds/");
-               path += name;
-               path += ".ogg";
-               return Resource::getPath(path);
-       }
+       return Resource::getPath(name, "sounds/", "ogg");
 }
 
 
This page took 0.020461 seconds and 4 git commands to generate.