mirror of https://github.com/ppy/osu
Clarify type check
This commit is contained in:
parent
1f1342b099
commit
485b7282dc
|
@ -188,10 +188,13 @@ public void CopyCommonSettingsFrom(Mod source)
|
||||||
if (sourceSetting.IsDefault)
|
if (sourceSetting.IsDefault)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var targetType = targetSetting.GetType();
|
var targetBindableType = targetSetting.GetType();
|
||||||
var sourceType = sourceSetting.GetType();
|
var sourceBindableType = sourceSetting.GetType();
|
||||||
|
|
||||||
if (!targetType.IsAssignableFrom(sourceType) && !sourceType.IsAssignableFrom(targetType))
|
// if either the target is assignable to the source or the source is assignable to the target,
|
||||||
|
// then we presume that the data types contained in both bindables are compatible and we can proceed with the copy.
|
||||||
|
// this handles cases like `Bindable<int>` and `BindableInt`.
|
||||||
|
if (!targetBindableType.IsAssignableFrom(sourceBindableType) && !sourceBindableType.IsAssignableFrom(targetBindableType))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// TODO: special case for handling number types
|
// TODO: special case for handling number types
|
||||||
|
|
Loading…
Reference in New Issue