Fix custom objections not playing sounds

This commit is contained in:
in1tiate 2021-07-22 12:26:57 -05:00
parent 5190490a07
commit 2d3cab82c8
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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)