mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Enable nullability for Robust.Shared.Maths
This commit is contained in:
@@ -152,7 +152,7 @@ namespace Robust.Shared.Maths
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
return obj is Angle angle && Equals(angle);
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace Robust.Shared.Maths
|
||||
Bottom.Equals(other.Bottom);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
return obj is Box2 box2 && Equals(box2);
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Robust.Shared.Maths
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
return obj is Box2Rotated other && Equals(other);
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Robust.Shared.Maths
|
||||
}
|
||||
|
||||
// override object.Equals
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is Box2i box)
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Robust.Shared.Maths
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
return obj is Circle circle && Equals(circle);
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Robust.Shared.Maths
|
||||
/// </summary>
|
||||
/// <param name="obj">An object to compare to.</param>
|
||||
/// <returns>True obj is a Color4 structure with the same components as this Color4; false otherwise.</returns>
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (!(obj is Color))
|
||||
return false;
|
||||
@@ -1817,8 +1817,7 @@ namespace Robust.Shared.Maths
|
||||
private static readonly Dictionary<Color, string> DefaultColorsInverted =
|
||||
DefaultColors.ToLookup(pair => pair.Value).ToDictionary(i => i.Key, i => i.First().Key);
|
||||
|
||||
[CanBeNull]
|
||||
public string Name()
|
||||
public string? Name()
|
||||
{
|
||||
return DefaultColorsInverted.TryGetValue(this, out var name) ? name : null;
|
||||
}
|
||||
|
||||
@@ -1094,7 +1094,7 @@ namespace Robust.Shared.Maths
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to compare with this matrix.</param>
|
||||
/// <returns>True if the instances are equal; false otherwise.</returns>
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (!(obj is Matrix4))
|
||||
return false;
|
||||
|
||||
@@ -822,12 +822,12 @@ namespace Robust.Shared.Maths
|
||||
/// <summary>
|
||||
/// Compares this object instance to another object for equality.
|
||||
/// </summary>
|
||||
/// <param name="other">The other object to be used in the comparison.</param>
|
||||
/// <param name="obj">The other object to be used in the comparison.</param>
|
||||
/// <returns>True if both objects are Quaternions of equal value. Otherwise it returns false.</returns>
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is Quaternion == false) return false;
|
||||
return this == (Quaternion) obj;
|
||||
if (obj is Quaternion quaternion) return this == quaternion;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion public override bool Equals (object o)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>x64</Platforms>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
|
||||
<ItemGroup>
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Robust.Shared.Maths
|
||||
Bottom.Equals(other.Bottom);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
return obj is UIBox2 box2 && Equals(box2);
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Robust.Shared.Maths
|
||||
}
|
||||
|
||||
// override object.Equals
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is UIBox2i box)
|
||||
{
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace Robust.Shared.Maths
|
||||
/// </summary>
|
||||
/// <param name="obj">Other object to check.</param>
|
||||
/// <returns>True if Object and vector are equal.</returns>
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is Vector2 vec && Equals(vec);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Robust.Shared.Maths
|
||||
/// </summary>
|
||||
/// <param name="obj">Other object to check.</param>
|
||||
/// <returns>True if Object and vector are equal.</returns>
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
return obj is Vector2i && Equals((Vector2i) obj);
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Robust.Shared.Maths
|
||||
/// </summary>
|
||||
/// <param name="obj">Other object to check.</param>
|
||||
/// <returns>True if Object and vector are equal.</returns>
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
return obj is Vector2u vec && Equals(vec);
|
||||
|
||||
@@ -1086,7 +1086,7 @@ namespace Robust.Shared.Maths
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to compare to.</param>
|
||||
/// <returns>True if the instances are equal; false otherwise.</returns>
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (!(obj is Vector3))
|
||||
return false;
|
||||
|
||||
@@ -876,7 +876,7 @@ namespace Robust.Shared.Maths
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to compare to.</param>
|
||||
/// <returns>True if the instances are equal; false otherwise.</returns>
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (!(obj is Vector4))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user