Pass delegate

This commit is contained in:
wrenge 2024-11-13 09:35:27 +03:00
parent 088edcd655
commit 18b544845f
1 changed files with 3 additions and 3 deletions

View File

@ -27,12 +27,12 @@ namespace DotRecast.Core.Collections
{ {
private bool _dirty; private bool _dirty;
private readonly List<T> _items; private readonly List<T> _items;
private readonly Comparer<T> _comparer; private readonly Comparison<T> _comparison;
public RcSortedQueue(Comparison<T> comp) public RcSortedQueue(Comparison<T> comp)
{ {
_items = new List<T>(); _items = new List<T>();
_comparer = Comparer<T>.Create((x, y) => comp.Invoke(x, y) * -1); _comparison = (x, y) => comp(x, y) * -1;
} }
public int Count() public int Count()
@ -55,7 +55,7 @@ namespace DotRecast.Core.Collections
{ {
if (_dirty) if (_dirty)
{ {
_items.Sort(_comparer); // reverse _items.Sort(_comparison); // reverse
_dirty = false; _dirty = false;
} }
} }