From fc2c8fa006c59dff2fbe3761f0eb0cc505578fcb Mon Sep 17 00:00:00 2001 From: siimav Date: Tue, 19 Mar 2024 14:42:56 +0200 Subject: [PATCH] Clean up temp lists in KJRMultiJointManager after finishing joint updates --- .../KerbalJointReinforcement/KJRManager.cs | 3 +++ .../KerbalJointReinforcement/KJRMultiJointManager.cs | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/KerbalJointReinforcement/KerbalJointReinforcement/KJRManager.cs b/KerbalJointReinforcement/KerbalJointReinforcement/KJRManager.cs index 21a460e..c5e1766 100644 --- a/KerbalJointReinforcement/KerbalJointReinforcement/KJRManager.cs +++ b/KerbalJointReinforcement/KerbalJointReinforcement/KJRManager.cs @@ -320,6 +320,9 @@ private void RunVesselJointUpdateFunction(Vessel v) if (success || !child_parts) updatedVessels.Add(v); + multiJointManager.ClearTempLists(); + decouplerJointManager.ClearTempLists(); + Profiler.EndSample(); if (KJRJointUtils.settings.debug) Debug.Log($"[KJR] RunVesselJointUpdateFunction finished in {sw.Elapsed.TotalMilliseconds}ms"); } diff --git a/KerbalJointReinforcement/KerbalJointReinforcement/KJRMultiJointManager.cs b/KerbalJointReinforcement/KerbalJointReinforcement/KJRMultiJointManager.cs index eeaa254..919c650 100644 --- a/KerbalJointReinforcement/KerbalJointReinforcement/KJRMultiJointManager.cs +++ b/KerbalJointReinforcement/KerbalJointReinforcement/KJRMultiJointManager.cs @@ -228,5 +228,12 @@ public void OnJointBreak(Part part) multiJointDict.Remove(part); } } + + public void ClearTempLists() + { + linkPart1List.Clear(); + linkPart2List.Clear(); + linkedSet.Clear(); + } } }