From d34f7b2ad979947f569fc8254d10b1bc320f7011 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 19 Mar 2022 22:55:58 +0000 Subject: [PATCH] Remove unnecessary tests for current_music_type If the type is not None, an earlier statement will have already returned. Thus, the type can be assumed to be None if these test statements are reached. --- common/arch/sdl/digi_mixer_music.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/common/arch/sdl/digi_mixer_music.cpp b/common/arch/sdl/digi_mixer_music.cpp index a63af747c..782281b09 100644 --- a/common/arch/sdl/digi_mixer_music.cpp +++ b/common/arch/sdl/digi_mixer_music.cpp @@ -166,7 +166,6 @@ int mix_play_file(const char *filename, int loop, void (*const entry_hook_finish } // try loading music via given filename - if (current_music_type == CurrentMusicType::None) { current_music_type = load_mus_file(filename, loop, hook_finished_track); if (current_music_type != CurrentMusicType::None) @@ -175,7 +174,7 @@ int mix_play_file(const char *filename, int loop, void (*const entry_hook_finish // allow the shell convention tilde character to mean the user's home folder // chiefly used for default jukebox level song music referenced in 'descent.m3u' for Mac OS X - if (current_music_type == CurrentMusicType::None && *filename == '~') + if (*filename == '~') { const auto sep = PHYSFS_getDirSeparator(); const auto lensep = strlen(sep); @@ -189,16 +188,14 @@ int mix_play_file(const char *filename, int loop, void (*const entry_hook_finish } // no luck. so it might be in Searchpath. So try to build absolute path - if (current_music_type == CurrentMusicType::None) + if (PHYSFSX_getRealPath(filename, full_path)) { - PHYSFSX_getRealPath(filename, full_path); current_music_type = load_mus_file(full_path.data(), loop, hook_finished_track); if (current_music_type != CurrentMusicType::None) return 1; } // still nothin'? Let's open via PhysFS in case it's located inside an archive - if (current_music_type == CurrentMusicType::None) { if (RAIIPHYSFS_File filehandle{PHYSFS_openRead(filename)}) {