/// <param name="node">output node</param> public static void Postfix(ref ushort node) { if (!InSimulationThread()) { return; } if (SegmentData?.Start != null || SegmentData?.End != null) { Log.Debug($"MoveMiddleNode.Postfix()\n" + Environment.StackTrace, false); // scenario 3. if (node == NodeID2) { if (SplitSegmentPatch.SegmentData2 == null) { SplitSegmentPatch.SegmentData2 = SegmentData; } else { SplitSegmentPatch.SegmentData3 = SegmentData; } } } SegmentData = null; }
public static void Postfix() { if (!InSimulationThread()) { return; } SegmentData = null; }
public static void Prefix(ushort segment) { if (!InSimulationThread()) { return; } SegmentData = MoveItIntegration.CopySegment(segment); }
public static void Postfix() { if (!InSimulationThread()) { return; } Log.Debug($"SplitSegment.Postfix()\n" + Environment.StackTrace, false); SegmentData = SegmentData2 = SegmentData3 = null; }
public static void Prefix(ushort segment) { if (!InSimulationThread()) { return; } Log.Info($"SplitSegment.Prefix() segment:{segment}" /*\n" + Environment.StackTrace*/, true); SegmentData = MoveItIntegration.CopySegment(segment); }
// pastes segment ends that: // 1- not nullnot null and // 2- its nodeID matches input start/end nodeID. static void PasteSegment( MoveItSegmentData segmentData, ushort nodeID1, ushort nodeID2, ushort targetSegmentID) { if (segmentData == null) { return; } PasteSegmentEnd(segmentData.Start, nodeID1, nodeID2, targetSegmentID); PasteSegmentEnd(segmentData.End, nodeID1, nodeID2, targetSegmentID); }
public static void Prefix(ref ushort node) // TODO remove ref when in lates harmony. { if (!InSimulationThread()) { return; } ushort nodeID = node; ushort segmentID = NetUtil.GetFirstSegment(nodeID); SegmentData = MoveItIntegration.CopySegment(segmentID); }
/// <summary> /// scenario 1: no change - returns the input node. /// scenario 2: move node : segment is released and a smaller segment is created - returns the moved node. /// scenario 3: merge node: segment is released and the other node is returned. /// /// How to handle: /// 1: skip (DONE) /// 2: copy segment end for the node that didn't move (moved node cannot have customisations) (DONE) /// 3: when split-segment creates a new segment, that copy segment end to it. /// </summary> /// <param name="node">input node</param> public static void Prefix(ref ushort node) // TODO remove ref when in lates harmony. { if (!InSimulationThread()) { return; } NodeID = node; AssertEqual(NodeID.ToNode().CountSegments(), 1, "CountSegments"); ushort segmentID = NetUtil.GetFirstSegment(NodeID); Log.Info($"MoveMiddleNode.Prefix() node:{NodeID} segment:{segmentID}" /*+"\n" + Environment.StackTrace*/, true); SegmentData = MoveItIntegration.CopySegment(segmentID); NodeID2 = segmentID.ToSegment().GetOtherNode(NodeID); }
public static void Prefix(ushort segment) { if (UpgradingSegmentData != null) { KianCommons.Log.Error("Unexpected UpgradingSegmentData != null"); UpgradingSegmentData = null; } if (m_upgrading) { UpgradingSegmentData = MoveItIntegration.CopySegment(segment); } SegmentEndManager.Instance.SetAt(segmentID: segment, true, value: null); SegmentEndManager.Instance.SetAt(segmentID: segment, false, value: null); }
public static void Prefix(ushort segment) { if (UpgradingSegmentData != null) { KianCommons.Log.Error("Unexpected UpgradingSegmentData != null"); UpgradingSegmentData = null; } if (m_upgrading) { UpgradingSegmentData = MoveItIntegration.CopySegment(segment); } Log.Debug($"ReleaseSegment.Prefix({segment})\n" + Environment.StackTrace); SegmentEndManager.Instance.SetAt(segmentID: segment, true, value: null); SegmentEndManager.Instance.SetAt(segmentID: segment, false, value: null); }