Invert t comparison with -1 and un-nest rest of function

This is also another conditional where the rest of the function is
nested. Furthermore, in order to not repeat ourselves, I've also decided
to unconditionally assign currentsong to t, because if t is -1
currentsong gets assigned to -1 anyway - so it's the same thing, but
it's much easier to see and think about.
This commit is contained in:
Misa authored and Ethan Lee committed 2021-01-04 05:09:23 -05:00
1 parent fe5bacfdc2
commit f64cf4f831
1 file changed
+5 -7
+5 -7
View File
@@ -193,9 +193,12 @@ void musicclass::play(int t, const double position_sec /*= 0.0*/, const int fade
return;
}
if (t != -1)
currentsong = t;
if (t == -1)
{
currentsong = t;
return;
}
if (!INBOUNDS_VEC(t, musicTracks))
{
@@ -237,11 +240,6 @@ void musicclass::play(int t, const double position_sec /*= 0.0*/, const int fade
}
songStart = SDL_GetPerformanceCounter();
}
else
{
currentsong = -1;
}
}
void musicclass::resume(const int fadein_ms /*= 0*/)