Code cleanup.
This commit is contained in:
@@ -137,7 +137,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
AddChild(child.Key, cc, r);
|
AddChild(child.Key, cc, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pms = new Dictionary<StampedEvent, RealtimeMotionValue>(PlayingMotions.Count);
|
var pms = new Dictionary<StampedEvent, RealtimeMotionValue>(Math.Max(4, PlayingMotions.Count));
|
||||||
foreach (var m in PlayingMotions)
|
foreach (var m in PlayingMotions)
|
||||||
pms.Add(m.Key, m.Value);
|
pms.Add(m.Key, m.Value);
|
||||||
r.PlayingMotions = pms;
|
r.PlayingMotions = pms;
|
||||||
|
@@ -24,10 +24,9 @@ namespace Cryville.Crtr.Event {
|
|||||||
= new SimpleObjectPool<Dictionary<RealtimeMotionValue, Identifier>>(1024);
|
= new SimpleObjectPool<Dictionary<RealtimeMotionValue, Identifier>>(1024);
|
||||||
Dictionary<RealtimeMotionValue, Identifier> _rented;
|
Dictionary<RealtimeMotionValue, Identifier> _rented;
|
||||||
public RealtimeMotionValue Rent(Identifier name) {
|
public RealtimeMotionValue Rent(Identifier name) {
|
||||||
var n = name;
|
var obj = _buckets[name].Rent();
|
||||||
var obj = _buckets[n].Rent();
|
|
||||||
if (_rented == null) _rented = _dictPool.Rent();
|
if (_rented == null) _rented = _dictPool.Rent();
|
||||||
_rented.Add(obj, n);
|
_rented.Add(obj, name);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
public void Return(RealtimeMotionValue obj) {
|
public void Return(RealtimeMotionValue obj) {
|
||||||
@@ -35,6 +34,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
_rented.Remove(obj);
|
_rented.Remove(obj);
|
||||||
}
|
}
|
||||||
public void ReturnAll() {
|
public void ReturnAll() {
|
||||||
|
if (_rented == null) return;
|
||||||
foreach (var obj in _rented)
|
foreach (var obj in _rented)
|
||||||
_buckets[obj.Value].Return(obj.Key);
|
_buckets[obj.Value].Return(obj.Key);
|
||||||
_rented.Clear();
|
_rented.Clear();
|
||||||
|
Reference in New Issue
Block a user