fix ClientGameStateManager bug (#3727)

This commit is contained in:
Leon Friedrich
2023-01-24 16:16:48 +13:00
committed by GitHub
parent f8ba9fe517
commit fc985f07bf
2 changed files with 8 additions and 0 deletions

View File

@@ -462,6 +462,7 @@ namespace Robust.Client.GameStates
foreach (var entity in system.DirtyEntities)
{
DebugTools.Assert(toRemove.Count == 0);
// Check log level first to avoid the string alloc.
if (_sawmill.Level <= LogLevel.Debug)
_sawmill.Debug($"Entity {entity} was made dirty.");
@@ -521,6 +522,7 @@ namespace Robust.Client.GameStates
{
_entities.RemoveComponent(entity, comp);
}
toRemove.Clear();
// Re-add predicted removals
if (system.RemovedComponents.TryGetValue(entity, out var netIds))

View File

@@ -13,6 +13,7 @@ namespace Robust.Shared.Utility
public struct RemQueue<T>
{
public List<T>? List;
public int Count => List?.Count ?? 0;
public void Add(T t)
{
@@ -25,6 +26,11 @@ namespace Robust.Shared.Utility
return new(List);
}
public void Clear()
{
List?.Clear();
}
public struct Enumerator : IEnumerator<T>
{
private readonly bool _filled;