diff options
| author | Crystalwarrior <varsash@gmail.com> | 2019-11-04 17:13:52 +0300 |
|---|---|---|
| committer | Crystalwarrior <varsash@gmail.com> | 2019-11-04 17:13:52 +0300 |
| commit | 9939637dda8cf09fc4e1620378fc5ac5de8885f6 (patch) | |
| tree | 6d4e23784746721216cd9ae6a0c1eeb48c82cd9e /src/text_file_functions.cpp | |
| parent | d40292125710e2e6698ffad7f4a7d7dcc41eace6 (diff) | |
Fix the sound bonanza so they actually play
sfx player and blip player now both account for extension-less sound paths and also correctly handle paths that do provide the extension.
Diffstat (limited to 'src/text_file_functions.cpp')
| -rw-r--r-- | src/text_file_functions.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index da14413b..41b20f3a 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -527,7 +527,8 @@ QString AOApplication::get_sfx(QString p_identifier) QString AOApplication::get_sfx_suffix(QString sound_to_check) { - sound_to_check = get_sounds_path(sound_to_check); + if (sound_to_check.contains(".")) //We have what we could call a file extension + return sound_to_check; if (file_exists(sound_to_check + ".opus")) return sound_to_check + ".opus"; if (file_exists(sound_to_check + ".ogg")) @@ -541,6 +542,8 @@ QString AOApplication::get_sfx_suffix(QString sound_to_check) QString AOApplication::get_image_suffix(QString path_to_check) { + if (path_to_check.contains(".")) //We have what we could call a file extension + return path_to_check; if (file_exists(path_to_check + ".webp")) return path_to_check + ".webp"; if (file_exists(path_to_check + ".apng")) @@ -629,9 +632,9 @@ QString AOApplication::get_gender(QString p_char) if (f_result == "") return "sfx-blipmale"; - if (!file_exists(get_sfx_suffix(get_sfx(f_result)))) + if (!file_exists(get_sfx_suffix(get_sounds_path(f_result)))) { - if (file_exists(get_sfx_suffix(get_sfx("blips/" + f_result)))) + if (file_exists(get_sfx_suffix(get_sounds_path("blips/" + f_result)))) return "blips/" + f_result; //Return the cool kids variant return "sfx-blip" + f_result; //Return legacy variant |
