mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-11-04 18:29:41 +01:00
Check divisor in musicclass::play()
Previously, it was assuming that the number of PPPPPP/MMMMMM tracks would always be 16, since if that wasn't the case... then the game would rudely and abruptly segfault when attempting to load the file. Huh. But now that the game properly deals with invalid headers, it's possible for the number of tracks to be 0. So I'll need to remove this assumption.
This commit is contained in:
parent
4bfd9de371
commit
6bed5fc88c
1 changed files with 6 additions and 3 deletions
|
@ -151,12 +151,15 @@ void songend()
|
||||||
|
|
||||||
void musicclass::play(int t, const double position_sec /*= 0.0*/, const int fadein_ms /*= 3000*/)
|
void musicclass::play(int t, const double position_sec /*= 0.0*/, const int fadein_ms /*= 3000*/)
|
||||||
{
|
{
|
||||||
// No need to check if num_tracks is greater than 0, we wouldn't be here if it wasn't
|
|
||||||
if (mmmmmm && usingmmmmmm)
|
if (mmmmmm && usingmmmmmm)
|
||||||
{
|
{
|
||||||
t %= num_mmmmmm_tracks;
|
// Don't conjoin this if-statement with the above one...
|
||||||
|
if (num_mmmmmm_tracks > 0)
|
||||||
|
{
|
||||||
|
t %= num_mmmmmm_tracks;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (num_pppppp_tracks > 0)
|
||||||
{
|
{
|
||||||
t %= num_pppppp_tracks;
|
t %= num_pppppp_tracks;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue