diff --git a/Projects/Server/AssemblyHandler.cs b/Projects/Server/AssemblyHandler.cs index e99968de5..d70aa81d9 100644 --- a/Projects/Server/AssemblyHandler.cs +++ b/Projects/Server/AssemblyHandler.cs @@ -231,7 +231,9 @@ public static class AssemblyHandler public class TypeCache { +#if DEBUG_TYPES private static ILogger logger = LogFactory.GetLogger(typeof(TypeCache)); +#endif private Dictionary _nameMap = new(); private Dictionary _nameMapInsensitive = new(); @@ -285,15 +287,15 @@ public class TypeCache foreach (var (key, value) in fullNameMap) { var values = value.ToArray(); - _fullNameMap[HashUtility.ComputeHash64(key)] = value.ToArray(); -#if DEBUG + _fullNameMap[HashUtility.ComputeHash64(key)] = values; +#if DEBUG_TYPES if (values.Length > 1) { for (var i = 0; i < values.Length; i++) { var type = values[i]; logger.Warning( - "Duplicate type {Type1} for {Name}.", + "Duplicate type {Type} for {Name}.", type, key ); @@ -304,7 +306,22 @@ public class TypeCache foreach (var (key, value) in fullNameMapInsensitive) { - _fullNameMapInsensitive[HashUtility.ComputeHash64(key)] = value.ToArray(); + var values = value.ToArray(); + _fullNameMapInsensitive[HashUtility.ComputeHash64(key)] = values; +#if DEBUG_TYPES + if (values.Length > 1) + { + for (var i = 0; i < values.Length; i++) + { + var type = values[i]; + logger.Warning( + "Duplicate type {Type} for {Name}.", + type, + key + ); + } + } +#endif } } @@ -337,7 +354,7 @@ public class TypeCache public ref struct TypeEnumerator { - private Type[] _values; + private readonly Type[] _values; private int _index; private Type _current; diff --git a/Projects/UOContent/Engines/Spawners/SpawnerEntry.cs b/Projects/UOContent/Engines/Spawners/SpawnerEntry.cs index 1ff0deaf7..d364b3916 100644 --- a/Projects/UOContent/Engines/Spawners/SpawnerEntry.cs +++ b/Projects/UOContent/Engines/Spawners/SpawnerEntry.cs @@ -31,6 +31,7 @@ public partial class SpawnerEntry [SerializedJsonPropertyName("parameters")] private string _parameters; + [Tidy] [SerializedJsonIgnore] [SerializableField(5)] private List _spawned; @@ -95,10 +96,21 @@ public partial class SpawnerEntry [AfterDeserialization] private void AfterDeserialization() { - foreach (var e in Spawned) + // This wasn't tidy in the original code, but it is after generating the code. + for (var i = Spawned.Count - 1; i >= 0; i--) { - e.Spawner = _parent; + var e = Spawned[i]; + if (e == null) + { + Spawned.RemoveAt(i); + } + else + { + e.Spawner = _parent; + } } + + Spawned.TrimExcess(); } [JsonIgnore] diff --git a/Projects/UOContent/Misc/Email.cs b/Projects/UOContent/Misc/Email.cs index 242ace805..5e30ed30a 100644 --- a/Projects/UOContent/Misc/Email.cs +++ b/Projects/UOContent/Misc/Email.cs @@ -58,7 +58,7 @@ namespace Server.Misc var created = logEntry.Created; var speech = logEntry.Speech; writer.WriteLine( - @$"{created.Hour}:{created.Minute:00}:{created.Second:00} - {fromName} ({fromAccount}): '{speech}'" + $"{created.Hour}:{created.Minute:00}:{created.Second:00} - {fromName} ({fromAccount}): '{speech}'" ); }