fix: Fixes infinite loop in BinaryFileWriter (#1792)

### Summary
- Fixes infinite loop with binary file writer
- Removes extra buffer copying with binary file writer
- Removes storing type counts during world save file writing
- Fixes display cache self-deletion warning during world load
This commit is contained in:
Kamron Batman 2024-05-24 14:36:43 -07:00 • committed by GitHub
parent 0011db7f47
commit 9f1f314077
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 50 additions and 25 deletions

View file

@ -28,12 +28,9 @@ public static class EntityPersistence
IIndexInfo<I> indexInfo,
Dictionary<I, T> entities,
string savePath,
ConcurrentQueue<Type> types,
out Dictionary<string, int> counts
ConcurrentQueue<Type> types
) where T : class, ISerializable
{
counts = new Dictionary<string, int>();
var typeName = indexInfo.TypeName;
var path = Path.Combine(savePath, typeName);
@ -61,12 +58,6 @@ public static class EntityPersistence
e.SerializeTo(bin);
idx.Write((int)(bin.Position - start));
var type = e.GetType().FullName;
if (type != null)
{
counts[type] = (counts.TryGetValue(type, out var count) ? count : 0) + 1;
}
}
}