SimShift.MapTool.Ets2NavigationSegment.MatchExit C# (CSharp) Method

MatchExit() public method

public MatchExit ( int solI, Ets2NavigationSegment next ) : bool
solI int
next Ets2NavigationSegment
return bool
        public bool MatchExit(int solI, Ets2NavigationSegment next)
        {
            if (this.Type == Ets2NavigationSegmentType.Road)
            {
                var exitPoint = Options[solI].Points.LastOrDefault();
                bool res = false;
                foreach (var route in next.Options)
                {
                    var first = route.Points.FirstOrDefault();
                    if (first.CloseTo(exitPoint))
                    {
                        route.ExitLane = this.Options[solI].EntryLane;
                        if (route.ExitLane >= 0 && route.EntryLane >= 0)
                            route.Valid = true;
                        res = true;
                    }
                }

                return res;
            }
            else
            {
                return false;
            }
        }