From f1c9d18745882af78c3081d7a3638885d1b876a7 Mon Sep 17 00:00:00 2001 From: Amir Halloul Date: Wed, 3 Jun 2020 23:18:33 +0100 Subject: [PATCH] Properly initialize empty EntityId --- src/SampSharp.Entities/Entities/EntityId.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SampSharp.Entities/Entities/EntityId.cs b/src/SampSharp.Entities/Entities/EntityId.cs index 8f423014..33e45faf 100644 --- a/src/SampSharp.Entities/Entities/EntityId.cs +++ b/src/SampSharp.Entities/Entities/EntityId.cs @@ -25,7 +25,7 @@ public struct EntityId /// /// An empty entity identifier. /// - public static readonly EntityId Empty = new EntityId(); + public static readonly EntityId Empty = new EntityId(Guid.Empty, 65535); /// /// Initializes a new instance of the struct. @@ -55,6 +55,9 @@ public EntityId(Guid type, int handle) /// public bool Equals(EntityId other) { + if(Handle == 65535 && other.Handle == Handle) + return true; + return Type.Equals(other.Type) && (Handle == other.Handle || Type == Guid.Empty); }