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 authored and Ethan Lee committed 2021-01-04 05:09:23 -05:00
1 parent 96c479a11f
commit fe5bacfdc2
1 file changed
+4 -2
+4 -2
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*/)