Move remqueue to engine (#4700)

This commit is contained in:
metalgearsloth
2021-09-27 14:38:53 +10:00
committed by GitHub
parent 6474cfa5d6
commit c298a8dc8e
3 changed files with 0 additions and 77 deletions

View File

@@ -9,7 +9,6 @@ using Content.Server.Administration.Managers;
using Content.Server.Afk;
using Content.Server.Chat.Managers;
using Content.Shared.Administration;
using Content.Shared.Collections;
using Content.Shared.Voting;
using Robust.Server.Player;
using Robust.Shared.Configuration;

View File

@@ -1,75 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Content.Shared.Collections
{
// It's a Remie Queue now.
/// <summary>
/// Simple helper struct for "iterate collection and have a queue of things to remove when you're done",
/// to avoid concurrent iteration/modification.
/// </summary>
public struct RemQueue<T>
{
public List<T>? List;
public void Add(T t)
{
List ??= new();
List.Add(t);
}
public Enumerator GetEnumerator()
{
return new(List);
}
public struct Enumerator : IEnumerator<T>
{
private readonly bool _filled;
private List<T>.Enumerator _enumerator;
public Enumerator(List<T>? list)
{
if (list == null)
{
_filled = false;
_enumerator = default;
}
else
{
_filled = true;
_enumerator = list.GetEnumerator();
}
}
public bool MoveNext()
{
if (!_filled)
{
return false;
}
return _enumerator.MoveNext();
}
void IEnumerator.Reset()
{
if (_filled)
{
((IEnumerator) _enumerator).Reset();
}
}
public T Current => _enumerator.Current;
object? IEnumerator.Current => Current;
void IDisposable.Dispose()
{
}
}
}
}

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Content.Shared.CCVar;
using Content.Shared.Collections;
using Content.Shared.Hands.Components;
using Content.Shared.Physics;
using Content.Shared.Physics.Pull;