From 31400c4c641e39d4b09eebe29e86776fd72d9760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Cig=C3=A1nek?= Date: Thu, 9 Jan 2014 02:37:20 +0100 Subject: [PATCH] Removes per-frame caching of VesselSatellite.SignalProcessor This seems to fix the recent issues, although I'm not yet sure why. --- src/RemoteTech2/NetworkManager.cs | 2 +- src/RemoteTech2/VesselSatellite.cs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/RemoteTech2/NetworkManager.cs b/src/RemoteTech2/NetworkManager.cs index e44ef84..2b1eb71 100644 --- a/src/RemoteTech2/NetworkManager.cs +++ b/src/RemoteTech2/NetworkManager.cs @@ -108,7 +108,7 @@ public void FindPath(ISatellite start, IEnumerable commandStations) public IEnumerable> FindNeighbors(ISatellite s) { - if (!s.Powered || !Graph.ContainsKey(s.Guid)) return Enumerable.Empty>(); + if (!Graph.ContainsKey(s.Guid) || !s.Powered) return Enumerable.Empty>(); return Graph[s.Guid].Where(l => l.Target.Powered); } diff --git a/src/RemoteTech2/VesselSatellite.cs b/src/RemoteTech2/VesselSatellite.cs index 3f355e5..dccf0fc 100644 --- a/src/RemoteTech2/VesselSatellite.cs +++ b/src/RemoteTech2/VesselSatellite.cs @@ -8,7 +8,7 @@ namespace RemoteTech public class VesselSatellite : ISatellite { public bool Visible { - get { return SignalProcessor != null ? SignalProcessor.Visible : false; } + get { return SignalProcessor.Visible; } } public String Name { @@ -41,10 +41,11 @@ public class VesselSatellite : ISatellite public ISignalProcessor SignalProcessor { get { - return RTUtil.CachePerFrame(ref mSignalProcessor, () => - { - return SignalProcessors.FirstOrDefault(s => s.FlightComputer != null) ?? SignalProcessors.FirstOrDefault(); - }); +// return RTUtil.CachePerFrame(ref mSignalProcessor, () => +// { +// return SignalProcessors.FirstOrDefault(s => s.FlightComputer != null) ?? SignalProcessors[0]; +// }); + return SignalProcessors.FirstOrDefault(s => s.FlightComputer != null) ?? SignalProcessors[0]; } } @@ -81,7 +82,7 @@ public void OnConnectionRefresh(List> routes) } } - private CachedField mSignalProcessor; +// private CachedField mSignalProcessor; private CachedField mLocalControl; public VesselSatellite(List parts)