From 2d3cab82c896b86b1e107b8e1773572ac0fec6d3 Mon Sep 17 00:00:00 2001 From: in1tiate Date: Thu, 22 Jul 2021 12:26:57 -0500 Subject: [PATCH] Fix custom objections not playing sounds --- src/path_functions.cpp | 5 ++++- src/text_file_functions.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/path_functions.cpp b/src/path_functions.cpp index 2f5aaec..61df1c6 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 fbe8279..d9b341b 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)