When collecting music files that may have music info available for the
music info screen, do not add music files from music directory if game
music is configured for all levels of a level set.
This fixes a bug with showing music info for music files that is never
played in the game, which happens if there is no "unconfigured" music
in a custom music directory (because all contained music is configured
in the custom music configuration), so the program falls back to the
default music directory (which contains unconfigured music files which
can be played as in-game music, but which is never used in this case).
return music_info_listed_ext(list, basename, TRUE);
}
+static boolean checkLevelSetHasMusic_NoConf(void)
+{
+ int i;
+
+ for (i = leveldir_current->first_level;
+ i <= leveldir_current->last_level; i++)
+ if (levelset.music[level_nr] == MUS_UNDEFINED)
+ return TRUE;
+
+ return FALSE;
+}
+
void LoadMusicInfo(void)
{
char *music_directory = getCustomMusicDirectory_NoConf();
}
}
+ // if all levels have game music configured, do not read music from directory
+ if (!checkLevelSetHasMusic_NoConf())
+ read_music_from_directory = FALSE;
+
if ((dir = openDirectory(music_directory)) == NULL)
{
Warn("cannot read music directory '%s'", music_directory);