aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp
index f1e0c3b1f9..74c0086817 100644
--- a/engines/wintermute/base/sound/base_sound_manager.cpp
+++ b/engines/wintermute/base/sound/base_sound_manager.cpp
@@ -100,15 +100,14 @@ BaseSoundBuffer *BaseSoundMgr::addSound(const Common::String &filename, Audio::M
BaseSoundBuffer *sound;
Common::String useFilename = filename;
+ useFilename.toLowercase();
// try to switch WAV to OGG file (if available)
- AnsiString ext = PathUtil::getExtension(filename);
- if (StringUtil::compareNoCase(ext, "wav")) {
- AnsiString path = PathUtil::getDirectoryName(filename);
- AnsiString name = PathUtil::getFileNameWithoutExtension(filename);
-
- AnsiString newFile = PathUtil::combine(path, name + "ogg");
- if (BaseFileManager::getEngineInstance()->hasFile(newFile)) {
- useFilename = newFile;
+ if (useFilename.hasSuffix(".wav")) {
+ Common::String oggFilename = useFilename;
+ oggFilename.erase(oggFilename.size() - 4);
+ oggFilename = oggFilename + ".ogg";
+ if (BaseFileManager::getEngineInstance()->hasFile(oggFilename)) {
+ useFilename = oggFilename;
}
}