From ff54eb738e45bd786f24af6af98a86c57de8e856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Wed, 13 Sep 2023 13:14:54 +0200 Subject: [PATCH] UUID: Removed empty constructor, added static Create-Function --- GlitchyEngine/src/Content/AssetHandle.bf | 2 +- GlitchyEngine/src/Core/UUID.bf | 12 ++++++------ GlitchyEngine/src/World/Components/Components.bf | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/GlitchyEngine/src/Content/AssetHandle.bf b/GlitchyEngine/src/Content/AssetHandle.bf index e96a66d..810074c 100644 --- a/GlitchyEngine/src/Content/AssetHandle.bf +++ b/GlitchyEngine/src/Content/AssetHandle.bf @@ -24,7 +24,7 @@ struct AssetHandle : IHashable /// Create a new random AssetHandle public this() { - _uuid = UUID(); + _uuid = UUID.Create(); } private this(UUID uuid) diff --git a/GlitchyEngine/src/Core/UUID.bf b/GlitchyEngine/src/Core/UUID.bf index 9ceb479..b681d53 100644 --- a/GlitchyEngine/src/Core/UUID.bf +++ b/GlitchyEngine/src/Core/UUID.bf @@ -19,17 +19,17 @@ namespace GlitchyEngine.Core ((.)new => Serialize, (.)new => Deserialize)); } - /// Creates a new random UUID. - public this() - { - _uuid = s_Random.NextU64(); - } - /// Creates a new UUID with the given value. public this(uint64 uuid) { _uuid = uuid; } + + /// Creates a new random UUID. + public static UUID Create() + { + return UUID(s_Random.NextU64()); + } public int GetHashCode() { diff --git a/GlitchyEngine/src/World/Components/Components.bf b/GlitchyEngine/src/World/Components/Components.bf index 2fe7cf4..142e8e2 100644 --- a/GlitchyEngine/src/World/Components/Components.bf +++ b/GlitchyEngine/src/World/Components/Components.bf @@ -27,7 +27,7 @@ namespace GlitchyEngine.World /// Create a new IDComponent with a random UUID. public this() { - ID = UUID(); + ID = UUID.Create(); } public this(UUID id)