Пример #1
0
		protected override bool StartPathFind(ushort vehicleID, ref Vehicle vehicleData, Vector3 startPos, Vector3 endPos, bool startBothWays, bool endBothWays)
		{
            RoadManager.VehicleType vehicleType = RoadManager.VehicleType.PoliceCar;
            if ((vehicleData.m_flags & Vehicle.Flags.Emergency2) != Vehicle.Flags.None)
                vehicleType |= RoadManager.VehicleType.Emergency;

            return CustomCarAI.StartPathFind(this, vehicleID, ref vehicleData, startPos, endPos, startBothWays, endBothWays, vehicleType);
		}
        protected override bool StartPathFind(ushort vehicleID, ref Vehicle vehicleData, Vector3 startPos, Vector3 endPos, bool startBothWays, bool endBothWays)
        {
            RoadManager.VehicleType vehicleType = RoadManager.VehicleType.Ambulance;
            if ((vehicleData.m_flags & Vehicle.Flags.Emergency2) != Vehicle.Flags.None)
            {
                vehicleType |= RoadManager.VehicleType.Emergency;
            }

            VehicleInfo info             = this.m_info;
            bool        allowUnderground = (vehicleData.m_flags & (Vehicle.Flags.Underground | Vehicle.Flags.Transition)) != Vehicle.Flags.None;

            PathUnit.Position startPosA;
            PathUnit.Position startPosB;
            float             num;
            float             num2;

            PathUnit.Position endPosA;
            PathUnit.Position endPosB;
            float             num3;
            float             num4;

            if (CustomPathManager.FindPathPosition(startPos, ItemClass.Service.Road, NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle, info.m_vehicleType, allowUnderground, false, 32f, out startPosA, out startPosB, out num, out num2, vehicleType) && CustomPathManager.FindPathPosition(endPos, ItemClass.Service.Road, NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle, info.m_vehicleType, false, false, 32f, out endPosA, out endPosB, out num3, out num4, vehicleType))
            {
                if (!startBothWays || num < 10f)
                {
                    startPosB = default(PathUnit.Position);
                }
                if (!endBothWays || num3 < 10f)
                {
                    endPosB = default(PathUnit.Position);
                }
                uint path;
                bool createPathResult;
                CustomPathManager customPathManager = Singleton <PathManager> .instance as CustomPathManager;
                if (customPathManager != null)
                {
                    createPathResult = customPathManager.CreatePath(out path, ref Singleton <SimulationManager> .instance.m_randomizer, Singleton <SimulationManager> .instance.m_currentBuildIndex, startPosA, startPosB, endPosA, endPosB, NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle, info.m_vehicleType, 20000f, this.IsHeavyVehicle(), this.IgnoreBlocked(vehicleID, ref vehicleData), false, false, vehicleType);
                }
                else
                {
                    createPathResult = Singleton <PathManager> .instance.CreatePath(out path, ref Singleton <SimulationManager> .instance.m_randomizer, Singleton <SimulationManager> .instance.m_currentBuildIndex, startPosA, startPosB, endPosA, endPosB, NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle, info.m_vehicleType, 20000f, this.IsHeavyVehicle(), this.IgnoreBlocked(vehicleID, ref vehicleData), false, false);
                }
                if (createPathResult)
                {
                    if (vehicleData.m_path != 0u)
                    {
                        Singleton <PathManager> .instance.ReleasePath(vehicleData.m_path);
                    }
                    vehicleData.m_path   = path;
                    vehicleData.m_flags |= Vehicle.Flags.WaitingPath;
                    return(true);
                }
            }
            return(false);

            //return CustomCarAI.StartPathFind(this, vehicleID, ref vehicleData, startPos, endPos, startBothWays, endBothWays, vehicleType);
        }
Пример #3
0
        void EnableIcons()
        {
            RoadCustomizerTool rct = ToolsModifierControl.GetCurrentTool <RoadCustomizerTool>();

            if (rct != null)
            {
                RoadManager.VehicleType restrictions = rct.GetCurrentVehicleRestrictions();
                float speed = rct.GetCurrentSpeedRestrictions() * 50f;

                for (int i = 0; i < this.m_scrollablePanel.components.Count; i++)
                {
                    UIButton btn = this.m_scrollablePanel.components[i] as UIButton;

                    if (this.m_panelType == Panel.VehicleRestrictions)
                    {
                        RoadManager.VehicleType vehicleType = (RoadManager.VehicleType)btn.objectUserData;

                        if ((vehicleType & restrictions) == vehicleType)
                        {
                            btn.stringUserData  = "Selected";
                            btn.normalFgSprite  = btn.name;
                            btn.focusedFgSprite = btn.name;
                            btn.hoveredFgSprite = btn.name + "90%";
                            btn.pressedFgSprite = btn.name + "80%";
                        }
                        else if (vehicleType == RoadManager.VehicleType.EmergencyVehicles && (restrictions & RoadManager.VehicleType.Emergency) == RoadManager.VehicleType.Emergency)
                        {
                            btn.stringUserData  = "Emergency";
                            btn.hoveredFgSprite = btn.name + "90%";
                            btn.pressedFgSprite = btn.name + "80%";
                            StartCoroutine("EmergencyLights", btn);
                        }
                        else
                        {
                            btn.stringUserData  = null;
                            btn.normalFgSprite  = btn.name + "Deselected";
                            btn.focusedFgSprite = btn.name + "Deselected";
                            btn.hoveredFgSprite = btn.name + "80%";
                            btn.pressedFgSprite = btn.name + "90%";
                        }
                        btn.state = UIButton.ButtonState.Normal;
                    }
                    else if (this.m_panelType == Panel.SpeedRestrictions)
                    {
                        if (Mathf.Approximately((int)btn.objectUserData, speed))
                        {
                            m_selectedIndex = i;
                        }
                    }

                    btn.isEnabled = true;
                }
            }
        }
        public RoadManager.VehicleType ToggleRestriction(RoadManager.VehicleType vehicleType)
        {
            if (!AnyLaneSelected)
            {
                return(RoadManager.VehicleType.None);
            }

            RoadManager.VehicleType vehicleRestrictions = RoadManager.GetVehicleRestrictions(m_selectedLaneMarkers[0].m_lane);
            vehicleRestrictions ^= vehicleType;

            foreach (SegmentLaneMarker lane in m_selectedLaneMarkers)
            {
                RoadManager.SetVehicleRestrictions(lane.m_lane, vehicleRestrictions);
            }

            return(vehicleRestrictions);
        }
Пример #5
0
        protected void OnButtonClicked(UIComponent comp)
        {
            //object objectUserData = comp.objectUserData;
            RoadManager.VehicleType vehicleType = (RoadManager.VehicleType)Enum.Parse(typeof(RoadManager.VehicleType), comp.stringUserData);

            if (vehicleType != RoadManager.VehicleType.None)
            {
                //RoadManager.ToggleVehicleRestriction(vehicleType);
            }



            //NetInfo netInfo = objectUserData as NetInfo;
            //BuildingInfo buildingInfo = objectUserData as BuildingInfo;
            //if (netInfo != null)
            //{
            //    if (base.roadsOptionPanel != null)
            //    {
            //        base.roadsOptionPanel.Show();
            //    }
            //    NetTool netTool = ToolsModifierControl.SetTool<NetTool>();
            //    if (netTool != null)
            //    {
            //        netTool.m_prefab = netInfo;
            //    }
            //}
            //if (buildingInfo != null)
            //{
            //    if (base.roadsOptionPanel != null)
            //    {
            //        base.roadsOptionPanel.Hide();
            //    }
            //    BuildingTool buildingTool = ToolsModifierControl.SetTool<BuildingTool>();
            //    if (buildingTool != null)
            //    {
            //        buildingTool.m_prefab = buildingInfo;
            //        buildingTool.m_relocate = 0;
            //    }
            //}
        }
Пример #6
0
        public static bool FindPathPosition(Vector3 position, ItemClass.Service service, NetInfo.LaneType laneType, VehicleInfo.VehicleType vehicleTypes, bool allowUnderground, float maxDistance, out PathUnit.Position pathPosA, out PathUnit.Position pathPosB, out float distanceSqrA, out float distanceSqrB, RoadManager.VehicleType vehicleType)
        {
            Bounds     bounds   = new Bounds(position, new Vector3(maxDistance * 2f, maxDistance * 2f, maxDistance * 2f));
            int        num      = Mathf.Max((int)((bounds.min.x - 64f) / 64f + 135f), 0);
            int        num2     = Mathf.Max((int)((bounds.min.z - 64f) / 64f + 135f), 0);
            int        num3     = Mathf.Min((int)((bounds.max.x + 64f) / 64f + 135f), 269);
            int        num4     = Mathf.Min((int)((bounds.max.z + 64f) / 64f + 135f), 269);
            NetManager instance = Singleton <NetManager> .instance;

            pathPosA.m_segment = 0;
            pathPosA.m_lane    = 0;
            pathPosA.m_offset  = 0;
            distanceSqrA       = 1E+10f;
            pathPosB.m_segment = 0;
            pathPosB.m_lane    = 0;
            pathPosB.m_offset  = 0;
            distanceSqrB       = 1E+10f;
            float num5 = maxDistance * maxDistance;

            for (int i = num2; i <= num4; i++)
            {
                for (int j = num; j <= num3; j++)
                {
                    ushort num6 = instance.m_segmentGrid[i * 270 + j];
                    int    num7 = 0;
                    while (num6 != 0)
                    {
                        NetInfo info = instance.m_segments.m_buffer[(int)num6].Info;
                        if (info.m_class.m_service == service && (instance.m_segments.m_buffer[(int)num6].m_flags & NetSegment.Flags.Flooded) == NetSegment.Flags.None && (allowUnderground || !info.m_netAI.IsUnderground()))
                        {
                            ushort  startNode = instance.m_segments.m_buffer[(int)num6].m_startNode;
                            ushort  endNode   = instance.m_segments.m_buffer[(int)num6].m_endNode;
                            Vector3 position2 = instance.m_nodes.m_buffer[(int)startNode].m_position;
                            Vector3 position3 = instance.m_nodes.m_buffer[(int)endNode].m_position;
                            float   num8      = Mathf.Max(Mathf.Max(bounds.min.x - 64f - position2.x, bounds.min.z - 64f - position2.z), Mathf.Max(position2.x - bounds.max.x - 64f, position2.z - bounds.max.z - 64f));
                            float   num9      = Mathf.Max(Mathf.Max(bounds.min.x - 64f - position3.x, bounds.min.z - 64f - position3.z), Mathf.Max(position3.x - bounds.max.x - 64f, position3.z - bounds.max.z - 64f));
                            Vector3 b;
                            int     num10;
                            float   num11;
                            Vector3 b2;
                            int     num12;
                            float   num13;
                            if ((num8 < 0f || num9 < 0f) && instance.m_segments.m_buffer[(int)num6].m_bounds.Intersects(bounds) && CustomPathManager.GetClosestLanePosition(instance.m_segments.m_buffer[(int)num6], position, laneType, vehicleTypes, out b, out num10, out num11, out b2, out num12, out num13, vehicleType))
                            {
                                float num14 = Vector3.SqrMagnitude(position - b);
                                if (num14 < num5)
                                {
                                    num5 = num14;
                                    pathPosA.m_segment = num6;
                                    pathPosA.m_lane    = (byte)num10;
                                    pathPosA.m_offset  = (byte)Mathf.Clamp(Mathf.RoundToInt(num11 * 255f), 0, 255);
                                    distanceSqrA       = num14;
                                    num14 = Vector3.SqrMagnitude(position - b2);
                                    if (num12 == -1 || num14 >= maxDistance * maxDistance)
                                    {
                                        pathPosB.m_segment = 0;
                                        pathPosB.m_lane    = 0;
                                        pathPosB.m_offset  = 0;
                                        distanceSqrB       = 1E+10f;
                                    }
                                    else
                                    {
                                        pathPosB.m_segment = num6;
                                        pathPosB.m_lane    = (byte)num12;
                                        pathPosB.m_offset  = (byte)Mathf.Clamp(Mathf.RoundToInt(num13 * 255f), 0, 255);
                                        distanceSqrB       = num14;
                                    }
                                }
                            }
                        }
                        num6 = instance.m_segments.m_buffer[(int)num6].m_nextGridSegment;
                        if (++num7 >= 32768)
                        {
                            CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);

                            break;
                        }
                    }
                }
            }
            return(pathPosA.m_segment != 0);
        }
Пример #7
0
        public static bool FindPathPosition(Vector3 position, ItemClass.Service service, NetInfo.LaneType laneType, VehicleInfo.VehicleType vehicleTypes, bool allowUnderground, float maxDistance, out PathUnit.Position pathPos, RoadManager.VehicleType vehicleType)
        {
            PathUnit.Position position2;
            float             num;
            float             num2;

            return(CustomPathManager.FindPathPosition(position, service, laneType, vehicleTypes, allowUnderground, maxDistance, out pathPos, out position2, out num, out num2, vehicleType));
        }
Пример #8
0
        //public void WaitForAllPaths()
        //{
        //    while (!Monitor.TryEnter(this.m_queueLock, SimulationManager.SYNCHRONIZE_TIMEOUT))
        //    {
        //    }
        //    try
        //    {
        //        while ((this.m_queueFirst != 0u || this.m_calculating != 0u) && !this.m_terminated)
        //        {
        //            Monitor.Wait(this.m_queueLock);
        //        }
        //    }
        //    finally
        //    {
        //        Monitor.Exit(this.m_queueLock);
        //    }
        //}
        private void PathFindImplementation(uint unit, ref PathUnit data)
        {
            NetManager instance = Singleton<NetManager>.instance;
            this.m_laneTypes = (NetInfo.LaneType)this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_laneTypes;
            this.m_vehicleTypes = (VehicleInfo.VehicleType)this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_vehicleTypes;
            this.m_maxLength = this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_length;
            this.m_pathFindIndex = (this.m_pathFindIndex + 1u & 32767u);
            this.m_pathRandomizer = new Randomizer(unit);
            this.m_isHeavyVehicle = ((this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_simulationFlags & 16) != 0);
            this.m_ignoreBlocked = ((this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_simulationFlags & 32) != 0);
            this.m_stablePath = ((this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_simulationFlags & 64) != 0);

            if (!m_pathVehicleType.TryGetValue(unit, out m_vehicleType))
            {
                //if ((m_laneTypes & NetInfo.LaneType.Pedestrian) == NetInfo.LaneType.Pedestrian)
                    m_vehicleType = RoadManager.VehicleType.PassengerCar;
                //else
                //	m_vehicleType = RoadManager.VehicleType.None;
            }
            if ((CSLTraffic.Options & OptionsManager.ModOptions.ImprovedAI) == OptionsManager.ModOptions.ImprovedAI)
                this.m_prioritizeBusLanes = (this.m_vehicleType & (RoadManager.VehicleType.Bus | RoadManager.VehicleType.Emergency)) != RoadManager.VehicleType.None;
            else
                this.m_prioritizeBusLanes = false;

            int num = (int)(this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_positionCount & 15);
            int num2 = this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_positionCount >> 4;
            CustomPathFind.BufferItem bufferItem;
            if (data.m_position00.m_segment != 0 && num >= 1)
            {
                //if (NetManager.instance.m_segments.m_buffer[data.m_position00.m_segment].Info == null)
                //{
                //	this.m_pathUnits.m_buffer[unit].m_pathFindFlags |= 8;
                //	return;
                //}

                this.m_startLaneA = PathManager.GetLaneID(data.m_position00);
                this.m_startOffsetA = data.m_position00.m_offset;
                bufferItem.m_laneID = this.m_startLaneA;
                bufferItem.m_position = data.m_position00;
                this.GetLaneDirection(data.m_position00, out bufferItem.m_direction, out bufferItem.m_lanesUsed);
                bufferItem.m_comparisonValue = 0f;

            }
            else
            {
                this.m_startLaneA = 0u;
                this.m_startOffsetA = 0;
                bufferItem = default(CustomPathFind.BufferItem);
            }
            CustomPathFind.BufferItem bufferItem2;
            if (data.m_position02.m_segment != 0 && num >= 3)
            {
                //if (NetManager.instance.m_segments.m_buffer[data.m_position02.m_segment].Info == null)
                //{
                //	this.m_pathUnits.m_buffer[unit].m_pathFindFlags |= 8;
                //	return;
                //}

                this.m_startLaneB = PathManager.GetLaneID(data.m_position02);
                this.m_startOffsetB = data.m_position02.m_offset;
                bufferItem2.m_laneID = this.m_startLaneB;
                bufferItem2.m_position = data.m_position02;
                this.GetLaneDirection(data.m_position02, out bufferItem2.m_direction, out bufferItem2.m_lanesUsed);
                bufferItem2.m_comparisonValue = 0f;
            }
            else
            {
                this.m_startLaneB = 0u;
                this.m_startOffsetB = 0;
                bufferItem2 = default(CustomPathFind.BufferItem);
            }
            CustomPathFind.BufferItem bufferItem3;
            if (data.m_position01.m_segment != 0 && num >= 2)
            {
                //if (NetManager.instance.m_segments.m_buffer[data.m_position01.m_segment].Info == null)
                //{
                //	this.m_pathUnits.m_buffer[unit].m_pathFindFlags |= 8;
                //	return;
                //}

                this.m_endLaneA = PathManager.GetLaneID(data.m_position01);
                bufferItem3.m_laneID = this.m_endLaneA;
                bufferItem3.m_position = data.m_position01;
                this.GetLaneDirection(data.m_position01, out bufferItem3.m_direction, out bufferItem3.m_lanesUsed);
                bufferItem3.m_methodDistance = 0f;
                bufferItem3.m_comparisonValue = 0f;
            }
            else
            {
                this.m_endLaneA = 0u;
                bufferItem3 = default(CustomPathFind.BufferItem);
            }
            CustomPathFind.BufferItem bufferItem4;
            if (data.m_position03.m_segment != 0 && num >= 4)
            {
                //if (NetManager.instance.m_segments.m_buffer[data.m_position03.m_segment].Info == null)
                //{
                //	this.m_pathUnits.m_buffer[unit].m_pathFindFlags |= 8;
                //	return;
                //}

                this.m_endLaneB = PathManager.GetLaneID(data.m_position03);
                bufferItem4.m_laneID = this.m_endLaneB;
                bufferItem4.m_position = data.m_position03;
                this.GetLaneDirection(data.m_position03, out bufferItem4.m_direction, out bufferItem4.m_lanesUsed);
                bufferItem4.m_methodDistance = 0f;
                bufferItem4.m_comparisonValue = 0f;
            }
            else
            {
                this.m_endLaneB = 0u;
                bufferItem4 = default(CustomPathFind.BufferItem);
            }
            if (data.m_position11.m_segment != 0 && num2 >= 1)
            {
                this.m_vehicleLane = PathManager.GetLaneID(data.m_position11);
                this.m_vehicleOffset = data.m_position11.m_offset;
            }
            else
            {
                this.m_vehicleLane = 0u;
                this.m_vehicleOffset = 0;
            }
            CustomPathFind.BufferItem bufferItem5 = default(CustomPathFind.BufferItem);
            byte b = 0;
            this.m_bufferMinPos = 0;
            this.m_bufferMaxPos = -1;
            if (this.m_pathFindIndex == 0u)
            {
                uint num3 = 4294901760u;
                for (int i = 0; i < 262144; i++)
                {
                    this.m_laneLocation[i] = num3;
                }
            }
            for (int j = 0; j < 1024; j++)
            {
                this.m_bufferMin[j] = 0;
                this.m_bufferMax[j] = -1;
            }
            if (bufferItem3.m_position.m_segment != 0)
            {
                this.m_bufferMax[0]++;
                this.m_buffer[++this.m_bufferMaxPos] = bufferItem3;
            }
            if (bufferItem4.m_position.m_segment != 0)
            {
                this.m_bufferMax[0]++;
                this.m_buffer[++this.m_bufferMaxPos] = bufferItem4;
            }
            bool flag = false;
            while (this.m_bufferMinPos <= this.m_bufferMaxPos)
            {
                int num4 = this.m_bufferMin[this.m_bufferMinPos];
                int num5 = this.m_bufferMax[this.m_bufferMinPos];
                if (num4 > num5)
                {
                    this.m_bufferMinPos++;
                }
                else
                {
                    this.m_bufferMin[this.m_bufferMinPos] = num4 + 1;
                    CustomPathFind.BufferItem bufferItem6 = this.m_buffer[(this.m_bufferMinPos << 6) + num4];
                    if (bufferItem6.m_position.m_segment == bufferItem.m_position.m_segment && bufferItem6.m_position.m_lane == bufferItem.m_position.m_lane)
                    {
                        if ((byte)(bufferItem6.m_direction & NetInfo.Direction.Forward) != 0 && bufferItem6.m_position.m_offset >= this.m_startOffsetA)
                        {
                            bufferItem5 = bufferItem6;
                            b = this.m_startOffsetA;
                            flag = true;
                            break;
                        }
                        if ((byte)(bufferItem6.m_direction & NetInfo.Direction.Backward) != 0 && bufferItem6.m_position.m_offset <= this.m_startOffsetA)
                        {
                            bufferItem5 = bufferItem6;
                            b = this.m_startOffsetA;
                            flag = true;
                            break;
                        }
                    }
                    if (bufferItem6.m_position.m_segment == bufferItem2.m_position.m_segment && bufferItem6.m_position.m_lane == bufferItem2.m_position.m_lane)
                    {
                        if ((byte)(bufferItem6.m_direction & NetInfo.Direction.Forward) != 0 && bufferItem6.m_position.m_offset >= this.m_startOffsetB)
                        {
                            bufferItem5 = bufferItem6;
                            b = this.m_startOffsetB;
                            flag = true;
                            break;
                        }
                        if ((byte)(bufferItem6.m_direction & NetInfo.Direction.Backward) != 0 && bufferItem6.m_position.m_offset <= this.m_startOffsetB)
                        {
                            bufferItem5 = bufferItem6;
                            b = this.m_startOffsetB;
                            flag = true;
                            break;
                        }
                    }
                    if ((byte)(bufferItem6.m_direction & NetInfo.Direction.Forward) != 0)
                    {
                        ushort startNode = instance.m_segments.m_buffer[(int)bufferItem6.m_position.m_segment].m_startNode;
                        this.ProcessItem(bufferItem6, startNode, ref instance.m_nodes.m_buffer[(int)startNode], 0, false);
                    }
                    if ((byte)(bufferItem6.m_direction & NetInfo.Direction.Backward) != 0)
                    {
                        ushort endNode = instance.m_segments.m_buffer[(int)bufferItem6.m_position.m_segment].m_endNode;
                        this.ProcessItem(bufferItem6, endNode, ref instance.m_nodes.m_buffer[(int)endNode], 255, false);
                    }
                    int num6 = 0;
                    ushort num7 = instance.m_lanes.m_buffer[(int)((UIntPtr)bufferItem6.m_laneID)].m_nodes;
                    if (num7 != 0)
                    {
                        ushort startNode2 = instance.m_segments.m_buffer[(int)bufferItem6.m_position.m_segment].m_startNode;
                        ushort endNode2 = instance.m_segments.m_buffer[(int)bufferItem6.m_position.m_segment].m_endNode;
                        bool flag2 = ((instance.m_nodes.m_buffer[(int)startNode2].m_flags | instance.m_nodes.m_buffer[(int)endNode2].m_flags) & NetNode.Flags.Disabled) != NetNode.Flags.None;
                        while (num7 != 0)
                        {
                            NetInfo.Direction direction = NetInfo.Direction.None;
                            byte laneOffset = instance.m_nodes.m_buffer[(int)num7].m_laneOffset;
                            if (laneOffset <= bufferItem6.m_position.m_offset)
                            {
                                direction |= NetInfo.Direction.Forward;
                            }
                            if (laneOffset >= bufferItem6.m_position.m_offset)
                            {
                                direction |= NetInfo.Direction.Backward;
                            }
                            if ((byte)(bufferItem6.m_direction & direction) != 0 && (!flag2 || (instance.m_nodes.m_buffer[(int)num7].m_flags & NetNode.Flags.Disabled) != NetNode.Flags.None))
                            {
                                this.ProcessItem(bufferItem6, num7, ref instance.m_nodes.m_buffer[(int)num7], laneOffset, true);
                            }
                            num7 = instance.m_nodes.m_buffer[(int)num7].m_nextLaneNode;
                            if (++num6 == 32768)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            if (!flag)
            {
                PathUnit[] expr_8D5_cp_0 = this.m_pathUnits.m_buffer;
                UIntPtr expr_8D5_cp_1 = (UIntPtr)unit;
                expr_8D5_cp_0[(int)expr_8D5_cp_1].m_pathFindFlags = (byte)(expr_8D5_cp_0[(int)expr_8D5_cp_1].m_pathFindFlags | 8);
                return;
            }
            float num8 = bufferItem5.m_comparisonValue * this.m_maxLength;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_length = num8;
            uint num9 = unit;
            int num10 = 0;
            int num11 = 0;
            PathUnit.Position position = bufferItem5.m_position;
            if ((position.m_segment != bufferItem3.m_position.m_segment || position.m_lane != bufferItem3.m_position.m_lane || position.m_offset != bufferItem3.m_position.m_offset) && (position.m_segment != bufferItem4.m_position.m_segment || position.m_lane != bufferItem4.m_position.m_lane || position.m_offset != bufferItem4.m_position.m_offset))
            {
                if (b != position.m_offset)
                {
                    PathUnit.Position position2 = position;
                    position2.m_offset = b;
                    this.m_pathUnits.m_buffer[(int)((UIntPtr)num9)].SetPosition(num10++, position2);
                }
                this.m_pathUnits.m_buffer[(int)((UIntPtr)num9)].SetPosition(num10++, position);
                position = this.m_laneTarget[(int)((UIntPtr)bufferItem5.m_laneID)];
            }
            for (int k = 0; k < 262144; k++)
            {
                this.m_pathUnits.m_buffer[(int)((UIntPtr)num9)].SetPosition(num10++, position);
                if ((position.m_segment == bufferItem3.m_position.m_segment && position.m_lane == bufferItem3.m_position.m_lane && position.m_offset == bufferItem3.m_position.m_offset) || (position.m_segment == bufferItem4.m_position.m_segment && position.m_lane == bufferItem4.m_position.m_lane && position.m_offset == bufferItem4.m_position.m_offset))
                {
                    this.m_pathUnits.m_buffer[(int)((UIntPtr)num9)].m_positionCount = (byte)num10;
                    num11 += num10;
                    if (num11 != 0)
                    {
                        num9 = this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_nextPathUnit;
                        num10 = (int)this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_positionCount;
                        int num12 = 0;
                        while (num9 != 0u)
                        {
                            this.m_pathUnits.m_buffer[(int)((UIntPtr)num9)].m_length = num8 * (float)(num11 - num10) / (float)num11;
                            num10 += (int)this.m_pathUnits.m_buffer[(int)((UIntPtr)num9)].m_positionCount;
                            num9 = this.m_pathUnits.m_buffer[(int)((UIntPtr)num9)].m_nextPathUnit;
                            if (++num12 >= 262144)
                            {
                                CODebugBase<LogChannel>.Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
                                break;
                            }
                        }
                    }
                    PathUnit[] expr_BE2_cp_0 = this.m_pathUnits.m_buffer;
                    UIntPtr expr_BE2_cp_1 = (UIntPtr)unit;
                    expr_BE2_cp_0[(int)expr_BE2_cp_1].m_pathFindFlags = (byte)(expr_BE2_cp_0[(int)expr_BE2_cp_1].m_pathFindFlags | 4);
                    return;
                }
                if (num10 == 12)
                {
                    while (!Monitor.TryEnter(this.m_bufferLock, SimulationManager.SYNCHRONIZE_TIMEOUT))
                    {
                    }
                    uint num13;
                    try
                    {
                        if (!this.m_pathUnits.CreateItem(out num13, ref this.m_pathRandomizer))
                        {
                            PathUnit[] expr_CE1_cp_0 = this.m_pathUnits.m_buffer;
                            UIntPtr expr_CE1_cp_1 = (UIntPtr)unit;
                            expr_CE1_cp_0[(int)expr_CE1_cp_1].m_pathFindFlags = (byte)(expr_CE1_cp_0[(int)expr_CE1_cp_1].m_pathFindFlags | 8);
                            return;
                        }
                        this.m_pathUnits.m_buffer[(int)((UIntPtr)num13)] = this.m_pathUnits.m_buffer[(int)((UIntPtr)num9)];
                        this.m_pathUnits.m_buffer[(int)((UIntPtr)num13)].m_referenceCount = 1;
                        this.m_pathUnits.m_buffer[(int)((UIntPtr)num13)].m_pathFindFlags = 4;
                        this.m_pathUnits.m_buffer[(int)((UIntPtr)num9)].m_nextPathUnit = num13;
                        this.m_pathUnits.m_buffer[(int)((UIntPtr)num9)].m_positionCount = (byte)num10;
                        num11 += num10;
                        Singleton<PathManager>.instance.m_pathUnitCount = (int)(this.m_pathUnits.ItemCount() - 1u);
                    }
                    finally
                    {
                        Monitor.Exit(this.m_bufferLock);
                    }
                    num9 = num13;
                    num10 = 0;
                }
                uint laneID = PathManager.GetLaneID(position);
                position = this.m_laneTarget[(int)((UIntPtr)laneID)];
            }
            PathUnit[] expr_D65_cp_0 = this.m_pathUnits.m_buffer;
            UIntPtr expr_D65_cp_1 = (UIntPtr)unit;
            expr_D65_cp_0[(int)expr_D65_cp_1].m_pathFindFlags = (byte)(expr_D65_cp_0[(int)expr_D65_cp_1].m_pathFindFlags | 8);
        }
Пример #9
0
 public NetInfoLane(RoadManager.VehicleType vehicleTypes)
 {
     this.m_allowedVehicleTypes = vehicleTypes;
 }
Пример #10
0
 public bool CreatePath(out uint unit, ref Randomizer randomizer, uint buildIndex, PathUnit.Position startPosA, PathUnit.Position startPosB, PathUnit.Position endPosA, PathUnit.Position endPosB, NetInfo.LaneType laneTypes, VehicleInfo.VehicleType vehicleTypes, float maxLength, bool isHeavyVehicle, bool ignoreBlocked, bool stablePath, bool skipQueue, RoadManager.VehicleType vehicleType)
 {
     return(this.CreatePath(out unit, ref randomizer, buildIndex, startPosA, startPosB, endPosA, endPosB, default(PathUnit.Position), laneTypes, vehicleTypes, maxLength, isHeavyVehicle, ignoreBlocked, stablePath, skipQueue, vehicleType));
 }
Пример #11
0
 public NetInfoLane(RoadManager.VehicleType vehicleTypes, SpecialLaneType specialLaneType = SpecialLaneType.None)
 {
     this.m_allowedVehicleTypes = vehicleTypes;
     this.m_specialLaneType     = specialLaneType;
 }
Пример #12
0
        protected void OnButtonClicked(UIButton btn)
        {
            if (m_panelType == Panel.VehicleRestrictions)
            {
                RoadManager.VehicleType vehicleType = (RoadManager.VehicleType)btn.objectUserData;
                if (vehicleType != RoadManager.VehicleType.None)
                {
                    if (String.IsNullOrEmpty(btn.stringUserData))
                    {
                        btn.stringUserData  = "Selected";
                        btn.normalFgSprite  = btn.name;
                        btn.focusedFgSprite = btn.name;
                        btn.hoveredFgSprite = btn.name + "90%";
                        btn.pressedFgSprite = btn.name + "80%";
                    }
                    else if (vehicleType == RoadManager.VehicleType.EmergencyVehicles && btn.stringUserData != "Emergency")
                    {
                        btn.stringUserData = "Emergency";
                        StartCoroutine("EmergencyLights", btn);
                    }
                    else
                    {
                        if (vehicleType == RoadManager.VehicleType.EmergencyVehicles)
                        {
                            StopCoroutine("EmergencyLights");
                        }

                        btn.stringUserData  = null;
                        btn.normalFgSprite  = btn.name + "Deselected";
                        btn.focusedFgSprite = btn.name + "Deselected";
                        btn.hoveredFgSprite = btn.name + "80%";
                        btn.pressedFgSprite = btn.name + "90%";
                    }

                    RoadCustomizerTool rct = ToolsModifierControl.GetCurrentTool <RoadCustomizerTool>();
                    if (rct != null)
                    {
                        if (btn.stringUserData == "Emergency")
                        {
                            rct.ToggleRestriction(vehicleType ^ RoadManager.VehicleType.Emergency);
                        }
                        else if (vehicleType == RoadManager.VehicleType.EmergencyVehicles && btn.stringUserData == null)
                        {
                            rct.ToggleRestriction(RoadManager.VehicleType.Emergency);
                        }
                        else
                        {
                            rct.ToggleRestriction(vehicleType);
                        }
                    }
                }
            }
            else if (m_panelType == Panel.SpeedRestrictions)
            {
                RoadCustomizerTool rct = ToolsModifierControl.GetCurrentTool <RoadCustomizerTool>();
                if (rct != null)
                {
                    rct.SetSpeedRestrictions((int)btn.objectUserData);
                }
            }
        }
Пример #13
0
        protected override void OnToolGUI()
        {
            base.OnToolGUI();

            if (m_toolButton == null)
            {
                m_toolButton = TryCreateToolButton();
            }

            if (m_selectedLaneMarkers.Count == 0)
            {
                return;
            }

            if (screenWidth != Screen.width || screenHeight != Screen.height)
            {
                screenWidth        = Screen.width;
                screenHeight       = Screen.height;
                laneButtonsStart   = (700 * screenHeight) / 1080;
                laneButtonsWidth   = 150;                        // font doesn't scale, so width must remain the same for every resolution
                laneButtonsHeight  = (20 * screenHeight) / 1080; // only causes problems in very low resolutions
                laneButtonsSpacing = (5 * screenHeight) / 1080;
            }

            RoadManager.VehicleType vehicleRestrictions = RoadManager.GetVehicleRestrictions(m_selectedLaneMarkers[0].m_lane);
            bool apply = false;
            int  i     = 1;

            if (GUI.Button(new Rect(10, laneButtonsStart, laneButtonsWidth, laneButtonsHeight), "Ambulances: " + ((vehicleRestrictions & RoadManager.VehicleType.Ambulance) == RoadManager.VehicleType.Ambulance ? "On" : "Off")))
            {
                vehicleRestrictions ^= RoadManager.VehicleType.Ambulance;
                apply = true;
            }
            if (GUI.Button(new Rect(10, laneButtonsStart + (laneButtonsHeight + laneButtonsSpacing) * i++, laneButtonsWidth, laneButtonsHeight), "Bus: " + ((vehicleRestrictions & RoadManager.VehicleType.Bus) == RoadManager.VehicleType.Bus ? "On" : "Off")))
            {
                vehicleRestrictions ^= RoadManager.VehicleType.Bus;
                apply = true;
            }
            if (GUI.Button(new Rect(10, laneButtonsStart + (laneButtonsHeight + laneButtonsSpacing) * i++, laneButtonsWidth, laneButtonsHeight), "Cargo Trucks: " + ((vehicleRestrictions & RoadManager.VehicleType.CargoTruck) == RoadManager.VehicleType.CargoTruck ? "On" : "Off")))
            {
                vehicleRestrictions ^= RoadManager.VehicleType.CargoTruck;
                apply = true;
            }
            if (GUI.Button(new Rect(10, laneButtonsStart + (laneButtonsHeight + laneButtonsSpacing) * i++, laneButtonsWidth, laneButtonsHeight), "Fire Trucks: " + ((vehicleRestrictions & RoadManager.VehicleType.FireTruck) == RoadManager.VehicleType.FireTruck ? "On" : "Off")))
            {
                vehicleRestrictions ^= RoadManager.VehicleType.FireTruck;
                apply = true;
            }
            if (GUI.Button(new Rect(10, laneButtonsStart + (laneButtonsHeight + laneButtonsSpacing) * i++, laneButtonsWidth, laneButtonsHeight), "Garbage Trucks: " + ((vehicleRestrictions & RoadManager.VehicleType.GarbageTruck) == RoadManager.VehicleType.GarbageTruck ? "On" : "Off")))
            {
                vehicleRestrictions ^= RoadManager.VehicleType.GarbageTruck;
                apply = true;
            }
            if (GUI.Button(new Rect(10, laneButtonsStart + (laneButtonsHeight + laneButtonsSpacing) * i++, laneButtonsWidth, laneButtonsHeight), "Hearses: " + ((vehicleRestrictions & RoadManager.VehicleType.Hearse) == RoadManager.VehicleType.Hearse ? "On" : "Off")))
            {
                vehicleRestrictions ^= RoadManager.VehicleType.Hearse;
                apply = true;
            }
            if (GUI.Button(new Rect(10, laneButtonsStart + (laneButtonsHeight + laneButtonsSpacing) * i++, laneButtonsWidth, laneButtonsHeight), "Citizens: " + ((vehicleRestrictions & RoadManager.VehicleType.PassengerCar) == RoadManager.VehicleType.PassengerCar ? "On" : "Off")))
            {
                vehicleRestrictions ^= RoadManager.VehicleType.PassengerCar;
                apply = true;
            }
            if (GUI.Button(new Rect(10, laneButtonsStart + (laneButtonsHeight + laneButtonsSpacing) * i++, laneButtonsWidth, laneButtonsHeight), "Police: " + ((vehicleRestrictions & RoadManager.VehicleType.PoliceCar) == RoadManager.VehicleType.PoliceCar ? "On" : "Off")))
            {
                vehicleRestrictions ^= RoadManager.VehicleType.PoliceCar;
                apply = true;
            }
            if (GUI.Button(new Rect(10, laneButtonsStart + (laneButtonsHeight + laneButtonsSpacing) * i++, laneButtonsWidth, laneButtonsHeight), "Emergency: " + ((vehicleRestrictions & RoadManager.VehicleType.Emergency) == RoadManager.VehicleType.Emergency ? "On" : "Off")))
            {
                vehicleRestrictions ^= RoadManager.VehicleType.Emergency;
                apply = true;
            }

            if (apply)
            {
                foreach (SegmentLaneMarker lane in m_selectedLaneMarkers)
                {
                    RoadManager.SetVehicleRestrictions(lane.m_lane, vehicleRestrictions);
                }
            }
        }
Пример #14
0
 public NetInfoLane(RoadManager.VehicleType vehicleTypes, SpecialLaneType specialLaneType = SpecialLaneType.None)
 {
     this.m_allowedVehicleTypes = vehicleTypes;
     this.m_specialLaneType = specialLaneType;
 }
Пример #15
0
 public NetInfoLane(NetInfo.Lane lane, RoadManager.VehicleType vehicleTypes)
 {
     CopyAttributes(lane);
     this.m_allowedVehicleTypes = vehicleTypes;
 }
Пример #16
0
 // NetSegment.GetClosestLane -- it's only called by the PathManager
 public static bool GetClosestLanePosition(NetSegment seg, Vector3 point, NetInfo.LaneType laneTypes, VehicleInfo.VehicleType vehicleTypes, out Vector3 positionA, out int laneIndexA, out float laneOffsetA, out Vector3 positionB, out int laneIndexB, out float laneOffsetB, RoadManager.VehicleType vehicleType)
 {
     positionA   = point;
     laneIndexA  = -1;
     laneOffsetA = 0f;
     positionB   = point;
     laneIndexB  = -1;
     laneOffsetB = 0f;
     if (seg.m_flags != NetSegment.Flags.None && seg.m_lanes != 0u)
     {
         NetInfo info = seg.Info;
         if (info.m_lanes != null)
         {
             float num  = 1E+09f;
             float num2 = 1E+09f;
             uint  num3 = seg.m_lanes;
             int   num4 = 0;
             while (num4 < info.m_lanes.Length && num3 != 0u)
             {
                 NetInfo.Lane lane = info.m_lanes[num4];
                 if (lane.CheckType(laneTypes, vehicleTypes) && RoadManager.CanUseLane(vehicleType, num3))
                 {
                     Vector3 vector;
                     float   num5;
                     Singleton <NetManager> .instance.m_lanes.m_buffer[(int)((UIntPtr)num3)].GetClosestPosition(point, out vector, out num5);
                     float num6 = Vector3.SqrMagnitude(point - vector);
                     if (lane.m_finalDirection == NetInfo.Direction.Backward || lane.m_finalDirection == NetInfo.Direction.AvoidForward)
                     {
                         if (num6 < num2)
                         {
                             num2        = num6;
                             positionB   = vector;
                             laneIndexB  = num4;
                             laneOffsetB = num5;
                         }
                     }
                     else if (num6 < num)
                     {
                         num         = num6;
                         positionA   = vector;
                         laneIndexA  = num4;
                         laneOffsetA = num5;
                     }
                 }
                 num3 = Singleton <NetManager> .instance.m_lanes.m_buffer[(int)((UIntPtr)num3)].m_nextLane;
                 num4++;
             }
             if (num2 < num)
             {
                 Vector3 vector2 = positionA;
                 int     num7    = laneIndexA;
                 float   num8    = laneOffsetA;
                 positionA   = positionB;
                 laneIndexA  = laneIndexB;
                 laneOffsetA = laneOffsetB;
                 positionB   = vector2;
                 laneIndexB  = num7;
                 laneOffsetB = num8;
             }
             if (!info.m_canCrossLanes)
             {
                 positionB   = point;
                 laneIndexB  = -1;
                 laneOffsetB = 0f;
             }
         }
     }
     return(laneIndexA != -1);
 }
Пример #17
0
 public bool CreatePath(out uint unit, ref Randomizer randomizer, uint buildIndex, PathUnit.Position startPosA, PathUnit.Position startPosB, PathUnit.Position endPosA, PathUnit.Position endPosB, NetInfo.LaneType laneTypes, VehicleInfo.VehicleType vehicleTypes, float maxLength, RoadManager.VehicleType vehicleType)
 {
     return(this.CreatePath(out unit, ref randomizer, buildIndex, startPosA, startPosB, endPosA, endPosB, default(PathUnit.Position), laneTypes, vehicleTypes, maxLength, false, false, false, false, vehicleType));
 }
Пример #18
0
 public NetInfoLane(NetInfo.Lane lane, RoadManager.VehicleType vehicleTypes, SpecialLaneType specialLaneType = SpecialLaneType.None) : this(vehicleTypes, specialLaneType)
 {
     CopyAttributes(lane);
 }
Пример #19
0
        public bool CreatePath(out uint unit, ref Randomizer randomizer, uint buildIndex, PathUnit.Position startPosA, PathUnit.Position startPosB, PathUnit.Position endPosA, PathUnit.Position endPosB, PathUnit.Position vehiclePosition, NetInfo.LaneType laneTypes, VehicleInfo.VehicleType vehicleTypes, float maxLength, bool isHeavyVehicle, bool ignoreBlocked, bool stablePath, bool skipQueue, RoadManager.VehicleType vehicleType)
        {
            while (!Monitor.TryEnter(this.m_bufferLock, SimulationManager.SYNCHRONIZE_TIMEOUT))
            {
            }
            uint num;

            try
            {
                if (!this.m_pathUnits.CreateItem(out num, ref randomizer))
                {
                    unit = 0u;
                    bool result = false;
                    return(result);
                }
                this.m_pathUnitCount = (int)(this.m_pathUnits.ItemCount() - 1u);
            }
            finally
            {
                Monitor.Exit(this.m_bufferLock);
            }
            unit = num;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_simulationFlags = 1;
            if (isHeavyVehicle)
            {
                PathUnit[] expr_92_cp_0 = this.m_pathUnits.m_buffer;
                UIntPtr    expr_92_cp_1 = (UIntPtr)unit;
                expr_92_cp_0[(int)expr_92_cp_1].m_simulationFlags = (byte)(expr_92_cp_0[(int)expr_92_cp_1].m_simulationFlags | 16);
            }
            if (ignoreBlocked)
            {
                PathUnit[] expr_BB_cp_0 = this.m_pathUnits.m_buffer;
                UIntPtr    expr_BB_cp_1 = (UIntPtr)unit;
                expr_BB_cp_0[(int)expr_BB_cp_1].m_simulationFlags = (byte)(expr_BB_cp_0[(int)expr_BB_cp_1].m_simulationFlags | 32);
            }
            if (stablePath)
            {
                PathUnit[] expr_E4_cp_0 = this.m_pathUnits.m_buffer;
                UIntPtr    expr_E4_cp_1 = (UIntPtr)unit;
                expr_E4_cp_0[(int)expr_E4_cp_1].m_simulationFlags = (byte)(expr_E4_cp_0[(int)expr_E4_cp_1].m_simulationFlags | 64);
            }
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_pathFindFlags  = 0;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_buildIndex     = buildIndex;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_position00     = startPosA;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_position01     = endPosA;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_position02     = startPosB;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_position03     = endPosB;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_position11     = vehiclePosition;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_nextPathUnit   = 0u;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_laneTypes      = (byte)laneTypes;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_vehicleTypes   = (byte)vehicleTypes;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_length         = maxLength;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_positionCount  = 20;
            this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_referenceCount = 1;
            int            num2     = 10000000;
            CustomPathFind pathFind = null;

            for (int i = 0; i < this.m_pathFinds.Length; i++)
            {
                CustomPathFind pathFind2 = this.m_pathFinds[i];
                if (pathFind2.IsAvailable && pathFind2.m_queuedPathFindCount < num2)
                {
                    num2     = pathFind2.m_queuedPathFindCount;
                    pathFind = pathFind2;
                }
            }
            if (pathFind != null && pathFind.CalculatePath(unit, skipQueue, vehicleType))
            {
                return(true);
            }
            this.ReleasePath(unit);
            return(false);
        }
Пример #20
0
        public static bool StartPathFind(CarAI carAI, ushort vehicleID, ref Vehicle vehicleData, Vector3 startPos, Vector3 endPos, bool startBothWays, bool endBothWays, RoadManager.VehicleType vehicleType)
        {
            VehicleInfo info = carAI.m_info;

            PathUnit.Position startPosA;
            PathUnit.Position startPosB;
            float             num;
            float             num2;

            PathUnit.Position endPosA;
            PathUnit.Position endPosB;
            float             num3;
            float             num4;

            if (CustomPathManager.FindPathPosition(startPos, ItemClass.Service.Road, NetInfo.LaneType.Vehicle, info.m_vehicleType, 32f, out startPosA, out startPosB, out num, out num2, vehicleType) && CustomPathManager.FindPathPosition(endPos, ItemClass.Service.Road, NetInfo.LaneType.Vehicle, info.m_vehicleType, 32f, out endPosA, out endPosB, out num3, out num4, vehicleType))
            {
                if (!startBothWays || num < 10f)
                {
                    startPosB = default(PathUnit.Position);
                }
                if (!endBothWays || num3 < 10f)
                {
                    endPosB = default(PathUnit.Position);
                }
                uint path;
                bool createPathResult;
                CustomPathManager customPathManager = Singleton <PathManager> .instance as CustomPathManager;
                if (customPathManager != null)
                {
                    createPathResult = customPathManager.CreatePath(out path, ref Singleton <SimulationManager> .instance.m_randomizer, Singleton <SimulationManager> .instance.m_currentBuildIndex, startPosA, startPosB, endPosA, endPosB, NetInfo.LaneType.Vehicle, info.m_vehicleType, 20000f, (carAI as IVehicle).IsHeavyVehicle(), (carAI as IVehicle).IgnoreBlocked(vehicleID, ref vehicleData), false, false, vehicleType);
                }
                else
                {
                    createPathResult = Singleton <PathManager> .instance.CreatePath(out path, ref Singleton <SimulationManager> .instance.m_randomizer, Singleton <SimulationManager> .instance.m_currentBuildIndex, startPosA, startPosB, endPosA, endPosB, NetInfo.LaneType.Vehicle, info.m_vehicleType, 20000f, (carAI as IVehicle).IsHeavyVehicle(), (carAI as IVehicle).IgnoreBlocked(vehicleID, ref vehicleData), false, false);
                }
                if (createPathResult)
                {
                    if (vehicleData.m_path != 0u)
                    {
                        Singleton <PathManager> .instance.ReleasePath(vehicleData.m_path);
                    }
                    vehicleData.m_path   = path;
                    vehicleData.m_flags |= Vehicle.Flags.WaitingPath;
                    return(true);
                }
            }
            return(false);
        }