forked from teamnwah/openmw-tes3coop
Fix regression with locating sound files
This commit is contained in:
parent
3b6826b1ac
commit
f7c7ed0ac7
4 changed files with 16 additions and 10 deletions
|
@ -136,7 +136,7 @@ namespace MWSound
|
||||||
max = std::max(min, max);
|
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
|
// 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)
|
void SoundManager::say (MWWorld::Ptr ptr, const std::string& filename)
|
||||||
{
|
{
|
||||||
// The range values are not tested
|
// 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())
|
if(!filePath.empty())
|
||||||
add(filePath, ptr, "_say_sound", 1, 1, 100, 20000, false);
|
add(filePath, ptr, "_say_sound", 1, 1, 100, 20000, false);
|
||||||
else
|
else
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace Files
|
||||||
boost::filesystem::path result("");
|
boost::filesystem::path result("");
|
||||||
if (sectionName == "")
|
if (sectionName == "")
|
||||||
{
|
{
|
||||||
return FileListLocator(mPriorityList, boost::filesystem::path(item), strict);
|
return FileListLocator(mPriorityList, boost::filesystem::path(item), strict, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ namespace Files
|
||||||
std::cout << "Warning: There is no section named " << sectionName << "\n";
|
std::cout << "Warning: There is no section named " << sectionName << "\n";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = FileListLocator(mMap[sectionName], boost::filesystem::path(item), strict);
|
result = FileListLocator(mMap[sectionName], boost::filesystem::path(item), strict, false);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,18 @@ bool isFile(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Locates path in path container
|
// 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("");
|
boost::filesystem::path result("");
|
||||||
if (list.empty())
|
if (list.empty())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
std::string toFindStr = toFind.string();
|
std::string toFindStr;
|
||||||
|
if (ignoreExtensions)
|
||||||
|
toFindStr = boost::filesystem::basename(toFind);
|
||||||
|
else
|
||||||
|
toFindStr = toFind.string();
|
||||||
|
|
||||||
std::string fullPath;
|
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
|
// 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.
|
/// that contains the searched path.
|
||||||
/// If it's not found it returns and empty path
|
/// If it's not found it returns and empty path
|
||||||
/// Takes care of slashes, backslashes and it has a strict option.
|
/// 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
|
/// 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…
Reference in a new issue