Slight refactoring of cdAudio_PlayTrack to use a switch on the enum, instead of an if, if-else structure

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5327 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-06-25 13:56:17 +00:00
parent 7af41b6f3a
commit 9fcaf6c08f
1 changed files with 11 additions and 8 deletions

View File

@ -127,17 +127,20 @@ BOOL cdAudio_PlayTrack(SONG_CONTEXT context)
{
debug(LOG_SOUND, "called(%d)", (int)context);
if (context == SONG_FRONTEND)
switch (context)
{
return cdAudio_OpenTrack("music/menu.ogg");
}
else if (context == SONG_INGAME)
{
const char *filename = PlayList_CurrentSong();
case SONG_FRONTEND:
return cdAudio_OpenTrack("music/menu.ogg");
return cdAudio_OpenTrack(filename);
case SONG_INGAME:
{
const char *filename = PlayList_CurrentSong();
return cdAudio_OpenTrack(filename);
}
}
ASSERT(false, "Bad parameter value");
ASSERT(!"Invalid songcontext", "Invalid song context specified for playing: %u", (unsigned int)context);
return false;
}