diff --git a/src/GameConstantsAndTypes.cpp b/src/GameConstantsAndTypes.cpp index f2279c6f5f..3d557fdbb8 100644 --- a/src/GameConstantsAndTypes.cpp +++ b/src/GameConstantsAndTypes.cpp @@ -360,12 +360,17 @@ float DisplayBpms::GetMin() const } float DisplayBpms::GetMax() const +{ + return this->GetMaxWithin(); +} + +float DisplayBpms::GetMaxWithin(float highest) const { float fMax = 0; FOREACH_CONST( float, vfBpms, f ) { if( *f != -1 ) - fMax = max( fMax, *f ); + fMax = clamp(max( fMax, *f ), 0, highest); } return fMax; } diff --git a/src/GameConstantsAndTypes.h b/src/GameConstantsAndTypes.h index 7242f4009d..1d86aa9b27 100644 --- a/src/GameConstantsAndTypes.h +++ b/src/GameConstantsAndTypes.h @@ -4,6 +4,7 @@ #define GAME_CONSTANTS_AND_TYPES_H #include "EnumHelper.h" +#include // need the max for default. // Note definitions /** @brief Define the mininum difficulty value allowed. */ @@ -513,6 +514,13 @@ struct DisplayBpms * @return the maximum BPM. */ float GetMax() const; + /** + * @brief Retrieve the maximum BPM of the set, + * but no higher than a certain value. + * @param highest the highest BPM to use. + * @return the maximum BPM. + */ + float GetMaxWithin(float highest = FLT_MAX) const; /** * @brief Determine if the BPM is really constant. * @return Whether the BPM is constant or not. diff --git a/src/Player.cpp b/src/Player.cpp index 1b49788e85..5ce14eb675 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -432,7 +432,7 @@ void Player::Init( // if the BPMs are < 0, reset and get the actual values. if( !bpms.IsSecret() ) { - fMaxBPM = bpms.GetMax(); + fMaxBPM = bpms.GetMaxWithin(600); fMaxBPM = max( 0, fMaxBPM ); }