mirror of https://github.com/ppy/osu
Fix incorrect `DifficultyBindable` logic
This commit is contained in:
parent
ae38e66036
commit
6813f5ee0a
|
@ -38,6 +38,7 @@ public float Precision
|
|||
|
||||
public float MinValue
|
||||
{
|
||||
get => minValue;
|
||||
set
|
||||
{
|
||||
if (value == minValue)
|
||||
|
@ -52,6 +53,7 @@ public float MinValue
|
|||
|
||||
public float MaxValue
|
||||
{
|
||||
get => maxValue;
|
||||
set
|
||||
{
|
||||
if (value == maxValue)
|
||||
|
@ -69,6 +71,7 @@ public float MaxValue
|
|||
/// </summary>
|
||||
public float? ExtendedMinValue
|
||||
{
|
||||
get => extendedMinValue;
|
||||
set
|
||||
{
|
||||
if (value == extendedMinValue)
|
||||
|
@ -86,6 +89,7 @@ public float? ExtendedMinValue
|
|||
/// </summary>
|
||||
public float? ExtendedMaxValue
|
||||
{
|
||||
get => extendedMaxValue;
|
||||
set
|
||||
{
|
||||
if (value == extendedMaxValue)
|
||||
|
@ -114,8 +118,13 @@ public override float? Value
|
|||
{
|
||||
// Ensure that in the case serialisation runs in the wrong order (and limit extensions aren't applied yet) the deserialised value is still propagated.
|
||||
if (value != null)
|
||||
CurrentNumber.MaxValue = MathF.Max(CurrentNumber.MaxValue, value.Value);
|
||||
{
|
||||
CurrentNumber.MinValue = Math.Clamp(MathF.Min(CurrentNumber.MinValue, value.Value), ExtendedMinValue ?? MinValue, MinValue);
|
||||
CurrentNumber.MaxValue = Math.Clamp(MathF.Max(CurrentNumber.MaxValue, value.Value), MaxValue, ExtendedMaxValue ?? MaxValue);
|
||||
|
||||
base.Value = Math.Clamp(value.Value, CurrentNumber.MinValue, CurrentNumber.MaxValue);
|
||||
}
|
||||
else
|
||||
base.Value = value;
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +147,8 @@ public override void CopyTo(Bindable<float?> them)
|
|||
// the following max value copies are only safe as long as these values are effectively constants.
|
||||
otherDifficultyBindable.MaxValue = maxValue;
|
||||
otherDifficultyBindable.ExtendedMaxValue = extendedMaxValue;
|
||||
otherDifficultyBindable.MinValue = minValue;
|
||||
otherDifficultyBindable.ExtendedMinValue = extendedMinValue;
|
||||
}
|
||||
|
||||
public override void BindTo(Bindable<float?> them)
|
||||
|
|
Loading…
Reference in New Issue