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 2021-01-03 23:23:46 -08:00 committed by Ethan Lee
parent fe5bacfdc2
commit f64cf4f831
1 changed files with 5 additions and 7 deletions

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*/)