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