Make mix_play_file only skip hmp for dot-less filenames
Previously, if the filename had no dots, then mix_play_file would refuse to play it at all. This was excessive, as only the check for hmp needs a filename with a dot in it. Change the logic so that a dot-less file still is assumed not to be an hmp, but instead of returning, will fall through and try the other load types.
This commit is contained in:
parent
c4cc119898
commit
d09d30e173
|
@ -151,19 +151,13 @@ static CurrentMusicType load_mus_file(const char *filename, int loop, void (*con
|
||||||
int mix_play_file(const char *filename, int loop, void (*const entry_hook_finished_track)())
|
int mix_play_file(const char *filename, int loop, void (*const entry_hook_finished_track)())
|
||||||
{
|
{
|
||||||
std::array<char, PATH_MAX> full_path;
|
std::array<char, PATH_MAX> full_path;
|
||||||
const char *fptr;
|
|
||||||
unsigned int bufsize = 0;
|
unsigned int bufsize = 0;
|
||||||
|
|
||||||
mix_free_music(); // stop and free what we're already playing, if anything
|
mix_free_music(); // stop and free what we're already playing, if anything
|
||||||
|
|
||||||
fptr = strrchr(filename, '.');
|
|
||||||
|
|
||||||
if (fptr == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
const auto hook_finished_track = entry_hook_finished_track ? entry_hook_finished_track : mix_free_music;
|
const auto hook_finished_track = entry_hook_finished_track ? entry_hook_finished_track : mix_free_music;
|
||||||
// It's a .hmp!
|
// It's a .hmp!
|
||||||
if (!d_stricmp(fptr, ".hmp"))
|
if (const auto fptr = strrchr(filename, '.'); fptr && !d_stricmp(fptr, ".hmp"))
|
||||||
{
|
{
|
||||||
hmp2mid(filename, current_music_hndlbuf);
|
hmp2mid(filename, current_music_hndlbuf);
|
||||||
current_music_type = load_mus_data(current_music_hndlbuf.data(), current_music_hndlbuf.size(), loop, hook_finished_track);
|
current_music_type = load_mus_data(current_music_hndlbuf.data(), current_music_hndlbuf.size(), loop, hook_finished_track);
|
||||||
|
|
Loading…
Reference in a new issue