public void AddSharedStop(ushort segment, ushort line, uint lane)
        {
            if (sharedStopSegments.Any(s => s.m_segment == segment))
            {
                var sharedStopSegment = sharedStopSegments[sharedStopSegments.FindIndex(s => s.m_segment == segment)];
                if (sharedStopSegment.m_lanes.Keys.Contains(lane))
                {
                    sharedStopSegment.m_lanes[lane].Add(line);
                    Log.Debug($"add to existing segment {segment}, lane: {lane}, line:{line}");
                }
                else
                {
                    sharedStopSegment.m_lanes.Add(lane, new List <ushort>()
                    {
                        line
                    });
                }
            }
            else
            {
                var newSegment = new SharedStopSegment(segment, line, lane);
                sharedStopSegments.Add(newSegment);
                Log.Debug($"add sharedsegment {segment}, {sharedStopSegments.Count}, lane: {lane}");
            }
            NetAI roadAi = Singleton <NetManager> .instance.m_segments.m_buffer[segment].Info.m_netAI;

            if (roadAi is RoadBridgeAI roadBridgeAI)
            {
                roadBridgeAI.UpdateSegmentStopFlags(segment, ref Singleton <NetManager> .instance.m_segments.m_buffer[segment]);
            }
        }
 public bool RemoveSharedStop(ushort segment, ushort line, uint lane)
 {
     if (sharedStopSegments.Any(s => s.m_segment == segment))
     {
         SharedStopSegment sharedStopSegment = sharedStopSegments[sharedStopSegments.FindIndex(s => s.m_segment == segment)];
         if (sharedStopSegment.m_lanes.Keys.Contains(lane))
         {
             sharedStopSegment.m_lanes[lane].Remove(line);
             Log.Debug($"removed line {line} from sharedsegment on lane {lane}");
             if (sharedStopSegment.m_lanes[lane].Count == 0)
             {
                 sharedStopSegment.m_lanes.Remove(lane);
                 Log.Debug($"removed lane {lane} from sharedsegment");
             }
         }
         if (sharedStopSegment.m_lanes.Count == 0)
         {
             Singleton <NetManager> .instance.m_segments.m_buffer[sharedStopSegment.m_segment].m_flags &= ~NetSegment.Flags.StopAll;
             sharedStopSegments.Remove(sharedStopSegment);
             Log.Debug($"removed sharedsegment {segment}");
         }
         return(true);
     }
     Log.Debug($"found no sharedsegment to remove");
     return(false);
 }