Rewrite our Equals implementations so they don't crash when comparing incompatible objects

This commit is contained in:
ScottNZ
2013-11-12 17:12:00 +13:00
parent 4f91c22fed
commit c373bc22e8
12 changed files with 24 additions and 58 deletions

View File

@@ -56,11 +56,8 @@ namespace OpenRA
public override bool Equals(object obj)
{
if (obj == null)
return false;
WPos o = (WPos)obj;
return o == this;
var o = obj as WPos?;
return o != null && o == this;
}
public override string ToString() { return "{0},{1},{2}".F(X, Y, Z); }