Invert currentsong check and un-nest rest of function

This removes an indentation level, and makes it easier to reason about
the function since you essentially now view it as the function returning
right there.
This commit is contained in:
Misa 2021-01-03 23:22:00 -08:00 committed by Ethan Lee
parent 96c479a11f
commit fe5bacfdc2
1 changed files with 4 additions and 2 deletions

View File

@ -188,8 +188,11 @@ void musicclass::play(int t, const double position_sec /*= 0.0*/, const int fade
safeToProcessMusic = true;
musicVolume = MIX_MAX_VOLUME;
if (currentsong != t)
if (currentsong == t)
{
return;
}
if (t != -1)
{
currentsong = t;
@ -239,7 +242,6 @@ void musicclass::play(int t, const double position_sec /*= 0.0*/, const int fade
{
currentsong = -1;
}
}
}
void musicclass::resume(const int fadein_ms /*= 0*/)