Fix regression with locating sound files

actorid
Michael Papageorgiou 13 years ago
parent 3b6826b1ac
commit f7c7ed0ac7

@ -136,7 +136,7 @@ namespace MWSound
max = std::max(min, max);
}
return Files::FileListLocator(mSoundFiles, snd->sound, mFSStrict);
return Files::FileListLocator(mSoundFiles, snd->sound, mFSStrict, true);
}
// Add a sound to the list and play it
@ -376,7 +376,7 @@ namespace MWSound
void SoundManager::say (MWWorld::Ptr ptr, const std::string& filename)
{
// The range values are not tested
std::string filePath = Files::FileListLocator(mSoundFiles, filename, mFSStrict);
std::string filePath = Files::FileListLocator(mSoundFiles, filename, mFSStrict, true);
if(!filePath.empty())
add(filePath, ptr, "_say_sound", 1, 1, 100, 20000, false);
else

@ -94,7 +94,7 @@ namespace Files
boost::filesystem::path result("");
if (sectionName == "")
{
return FileListLocator(mPriorityList, boost::filesystem::path(item), strict);
return FileListLocator(mPriorityList, boost::filesystem::path(item), strict, false);
}
else
{
@ -103,7 +103,7 @@ namespace Files
std::cout << "Warning: There is no section named " << sectionName << "\n";
return result;
}
result = FileListLocator(mMap[sectionName], boost::filesystem::path(item), strict);
result = FileListLocator(mMap[sectionName], boost::filesystem::path(item), strict, false);
}
return result;
}

@ -42,13 +42,18 @@ bool isFile(const char *name)
}
// Locates path in path container
boost::filesystem::path FileListLocator (const Files::PathContainer& list, const boost::filesystem::path& toFind, bool strict)
boost::filesystem::path FileListLocator (const Files::PathContainer& list, const boost::filesystem::path& toFind,
bool strict, bool ignoreExtensions)
{
boost::filesystem::path result("");
if (list.empty())
return result;
std::string toFindStr = toFind.string();
std::string toFindStr;
if (ignoreExtensions)
toFindStr = boost::filesystem::basename(toFind);
else
toFindStr = toFind.string();
std::string fullPath;
@ -94,9 +99,9 @@ bool isFile(const char *name)
}
// Overloaded form of the locator that takes a string and returns a string
std::string FileListLocator (const Files::PathContainer& list,const std::string& toFind, bool strict)
std::string FileListLocator (const Files::PathContainer& list,const std::string& toFind, bool strict, bool ignoreExtensions)
{
return FileListLocator(list, boost::filesystem::path(toFind), strict).string();
return FileListLocator(list, boost::filesystem::path(toFind), strict, ignoreExtensions).string();
}
}

@ -27,10 +27,11 @@ bool isFile(const char *name);
/// that contains the searched path.
/// If it's not found it returns and empty path
/// Takes care of slashes, backslashes and it has a strict option.
boost::filesystem::path FileListLocator (const Files::PathContainer& list, const boost::filesystem::path& toFind, bool strict);
boost::filesystem::path FileListLocator (const Files::PathContainer& list, const boost::filesystem::path& toFind,
bool strict, bool ignoreExtensions);
/// Overloaded form of the locator that takes a string and returns a string
std::string FileListLocator (const Files::PathContainer& list,const std::string& toFind, bool strict);
std::string FileListLocator (const Files::PathContainer& list,const std::string& toFind, bool strict, bool ignoreExtensions);
}

Loading…
Cancel
Save