aboutsummaryrefslogtreecommitdiff
path: root/text_file_functions.cpp
diff options
context:
space:
mode:
authorwewlad1 <30403438+wewlad1@users.noreply.github.com>2018-10-16 03:18:51 -0700
committerGitHub <noreply@github.com>2018-10-16 03:18:51 -0700
commit7e20b50b4fd48c8fe49bf1440dcf25910db86960 (patch)
tree5feea820e2f8fb3675c3ce8fe8e35ba13727a045 /text_file_functions.cpp
parent22640d482550fefec5406f4f819c8452f96be48d (diff)
parentd1347b2243c1595557d7b89d40eb88a68a94375b (diff)
Merge pull request #5 from Iamgoofball/patch-1
Fixes opus, adds opus and mp3 support to ini SFX, thanks Longbyte
Diffstat (limited to 'text_file_functions.cpp')
-rw-r--r--text_file_functions.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/text_file_functions.cpp b/text_file_functions.cpp
index 1aebc35e..5b057a4b 100644
--- a/text_file_functions.cpp
+++ b/text_file_functions.cpp
@@ -340,6 +340,26 @@ QString AOApplication::get_sfx(QString p_identifier)
return return_sfx;
}
+QString AOApplication::get_sfx_suffix(QString sound_to_check)
+{
+ QString wav_check = get_sounds_path() + sound_to_check + ".wav";
+ QString mp3_check = get_sounds_path() + sound_to_check + ".mp3";
+ QString opus_check = get_sounds_path() + sound_to_check + ".opus";
+ if(file_exists(opus_check))
+ {
+ return sound_to_check + ".opus";
+ }
+ if(file_exists(mp3_check))
+ {
+ return sound_to_check + ".mp3";
+ }
+ if(file_exists(wav_check))
+ {
+ return sound_to_check + ".wav";
+ }
+ return sound_to_check + ".wav";
+}
+
//returns whatever is to the right of "search_line =" within target_tag and terminator_tag, trimmed
//returns the empty string if the search line couldnt be found
QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag)
@@ -586,4 +606,4 @@ bool AOApplication::ic_scroll_down_enabled()
{
QString f_result = read_config("ic_scroll_down");
return f_result.startsWith("true");
-} \ No newline at end of file
+}