aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2021-07-22 14:00:20 -0500
committerGitHub <noreply@github.com>2021-07-22 14:00:20 -0500
commita4b5023088b4b00d2a54cd36909a95336851c898 (patch)
treea0c665b5c644f169d249facc002431646e51a174
parent5190490a07f929aef3ee0198f5bce251ff28dbea (diff)
parent2d3cab82c896b86b1e107b8e1773572ac0fec6d3 (diff)
Merge pull request #571 from AttorneyOnline/fix-568
Fix custom objections not playing sounds
-rw-r--r--src/path_functions.cpp5
-rw-r--r--src/text_file_functions.cpp2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/path_functions.cpp b/src/path_functions.cpp
index 2f5aaec4..61df1c60 100644
--- a/src/path_functions.cpp
+++ b/src/path_functions.cpp
@@ -264,7 +264,10 @@ QString AOApplication::get_real_suffixed_path(const VPath &vpath,
// Try cache first
QString phys_path = asset_lookup_cache.value(qHash(vpath));
if (!phys_path.isEmpty() && exists(phys_path)) {
- return phys_path;
+ for (const QString &suffix : suffixes) { // make sure cached asset is the right type
+ if (phys_path.endsWith(suffix, Qt::CaseInsensitive))
+ return phys_path;
+ }
}
// Cache miss; try each suffix on all known mount paths
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp
index fbe8279f..d9b341be 100644
--- a/src/text_file_functions.cpp
+++ b/src/text_file_functions.cpp
@@ -506,7 +506,7 @@ QString AOApplication::get_court_sfx(QString p_identifier, QString p_misc)
QString AOApplication::get_sfx_suffix(VPath sound_to_check)
{
return get_real_suffixed_path(sound_to_check,
- { "", ".opus", ".ogg", ".mp3", ".wav" });
+ {".opus", ".ogg", ".mp3", ".wav" });
}
QString AOApplication::get_image_suffix(VPath path_to_check, bool static_image)