Example #1
0
        public bool HasJunctionRestrictions(ushort nodeId)
        {
            if (!Services.NetService.IsNodeValid(nodeId))
            {
                return(false);
            }

            bool ret = false;

            Services.NetService.IterateNodeSegments(nodeId, delegate(ushort segmentId, ref NetSegment segment) {
                if (segmentId == 0)
                {
                    return(true);
                }

                Configuration.SegmentNodeFlags flags = Flags.getSegmentNodeFlags(segmentId, segment.m_startNode == nodeId);
                if (flags != null && !flags.IsDefault())
                {
                    ret = true;
                    return(false);
                }

                return(true);
            });

            return(ret);
        }
        public bool HasJunctionRestrictions(ushort nodeId)
        {
            NetManager netManager = Singleton <NetManager> .instance;

            if ((netManager.m_nodes.m_buffer[nodeId].m_flags & NetNode.Flags.Created) == NetNode.Flags.None)
            {
                return(false);
            }

            for (int i = 0; i < 8; ++i)
            {
                ushort segmentId = netManager.m_nodes.m_buffer[nodeId].GetSegment(i);
                if (segmentId == 0)
                {
                    continue;
                }

                Configuration.SegmentNodeFlags flags = Flags.getSegmentNodeFlags(segmentId, netManager.m_segments.m_buffer[segmentId].m_startNode == nodeId);
                if (flags != null && !flags.IsDefault())
                {
                    return(true);
                }
            }
            return(false);
        }
        internal bool HasJunctionRestrictions(ushort nodeId)
        {
            NetManager netManager = Singleton <NetManager> .instance;

            if ((netManager.m_nodes.m_buffer[nodeId].m_flags & NetNode.Flags.Created) == NetNode.Flags.None)
            {
                return(false);
            }

            for (int i = 0; i < 8; ++i)
            {
                ushort segmentId = netManager.m_nodes.m_buffer[nodeId].GetSegment(i);
                if (segmentId == 0)
                {
                    continue;
                }

                Configuration.SegmentNodeFlags flags = Flags.getSegmentNodeFlags(segmentId, netManager.m_segments.m_buffer[segmentId].m_startNode == nodeId);
                if ((flags.enterWhenBlockedAllowed != null && (bool)flags.enterWhenBlockedAllowed != Options.allowEnterBlockedJunctions) ||
                    (flags.straightLaneChangingAllowed != null && (bool)flags.straightLaneChangingAllowed != Options.allowLaneChangesWhileGoingStraight) ||
                    (flags.uturnAllowed != null && (bool)flags.uturnAllowed != Options.allowUTurns) ||
                    (flags.pedestrianCrossingAllowed != null && !(bool)flags.pedestrianCrossingAllowed))
                {
                    return(true);
                }
            }
            return(false);
        }
        private static void SaveSegmentNodeFlags(ushort segmentId, Configuration configuration)
        {
            try {
                if ((Singleton <NetManager> .instance.m_segments.m_buffer[segmentId].m_flags & NetSegment.Flags.Created) == NetSegment.Flags.None)
                {
                    return;
                }

                Configuration.SegmentNodeFlags startNodeFlags = Flags.getSegmentNodeFlags(segmentId, true);
                Configuration.SegmentNodeFlags endNodeFlags   = Flags.getSegmentNodeFlags(segmentId, false);

                if (startNodeFlags == null && endNodeFlags == null)
                {
                    return;
                }

                Configuration.SegmentNodeConf conf = new Configuration.SegmentNodeConf(segmentId);

                conf.startNodeFlags = startNodeFlags;
                conf.endNodeFlags   = endNodeFlags;

                Log.Info($"Saving segment-at-node flags for seg. {segmentId}");
                configuration.SegmentNodeConfs.Add(conf);
            } catch (Exception e) {
                Log.Error($"Error adding Priority Segments to Save: {e.ToString()}");
            }
        }
Example #5
0
        internal static void setSegmentNodeFlags(ushort segmentId, bool startNode, Configuration.SegmentNodeFlags flags)
        {
            if (flags == null)
            {
                return;
            }

            int index = startNode ? 0 : 1;

            segmentNodeFlags[segmentId][index] = flags;
        }
        private static void SaveSegmentNodeFlags(ushort segmentId, Configuration configuration)
        {
            try {
                NetManager netManager = Singleton <NetManager> .instance;

                if (!NetUtil.IsSegmentValid(segmentId))
                {
                    return;
                }

                ushort startNodeId = netManager.m_segments.m_buffer[segmentId].m_startNode;
                ushort endNodeId   = netManager.m_segments.m_buffer[segmentId].m_endNode;

                Configuration.SegmentNodeFlags startNodeFlags = NetUtil.IsNodeValid(startNodeId) ? Flags.getSegmentNodeFlags(segmentId, true) : null;
                Configuration.SegmentNodeFlags endNodeFlags   = NetUtil.IsNodeValid(endNodeId) ? Flags.getSegmentNodeFlags(segmentId, false) : null;

                if (startNodeFlags == null && endNodeFlags == null)
                {
                    return;
                }

                bool isDefaultConfiguration = true;
                if (startNodeFlags != null)
                {
                    if (!startNodeFlags.IsDefault())
                    {
                        isDefaultConfiguration = false;
                    }
                }

                if (endNodeFlags != null)
                {
                    if (!endNodeFlags.IsDefault())
                    {
                        isDefaultConfiguration = false;
                    }
                }

                if (isDefaultConfiguration)
                {
                    return;
                }

                Configuration.SegmentNodeConf conf = new Configuration.SegmentNodeConf(segmentId);

                conf.startNodeFlags = startNodeFlags;
                conf.endNodeFlags   = endNodeFlags;

                Log._Debug($"Saving segment-at-node flags for seg. {segmentId}");
                configuration.SegmentNodeConfs.Add(conf);
            } catch (Exception e) {
                Log.Error($"Error adding Priority Segments to Save: {e.ToString()}");
            }
        }
        public static void OnBeforeLoadData()
        {
            if (initDone)
            {
                return;
            }

            laneSpeedLimitArray          = new ushort?[Singleton <NetManager> .instance.m_segments.m_size][];
            laneArrowFlags               = new LaneArrows?[Singleton <NetManager> .instance.m_lanes.m_size];
            laneAllowedVehicleTypesArray = new ExtVehicleType?[Singleton <NetManager> .instance.m_segments.m_size][];
            highwayLaneArrowFlags        = new LaneArrows?[Singleton <NetManager> .instance.m_lanes.m_size];
            nodeTrafficLightFlag         = new bool?[Singleton <NetManager> .instance.m_nodes.m_size];
            segmentNodeFlags             = new Configuration.SegmentNodeFlags[Singleton <NetManager> .instance.m_segments.m_size][];
            for (int i = 0; i < segmentNodeFlags.Length; ++i)
            {
                segmentNodeFlags[i] = new Configuration.SegmentNodeFlags[2];
            }
            initDone = true;
        }
Example #8
0
        public static void OnBeforeLoadData()
        {
            if (initDone)
            {
                return;
            }

            laneConnections              = new uint[NetManager.MAX_LANE_COUNT][][];
            laneSpeedLimitArray          = new ushort?[NetManager.MAX_SEGMENT_COUNT][];
            laneArrowFlags               = new LaneArrows?[NetManager.MAX_LANE_COUNT];
            laneAllowedVehicleTypesArray = new ExtVehicleType?[NetManager.MAX_SEGMENT_COUNT][];
            highwayLaneArrowFlags        = new LaneArrows?[NetManager.MAX_LANE_COUNT];
            nodeTrafficLightFlag         = new bool?[NetManager.MAX_NODE_COUNT];
            segmentNodeFlags             = new Configuration.SegmentNodeFlags[NetManager.MAX_SEGMENT_COUNT][];
            for (int i = 0; i < segmentNodeFlags.Length; ++i)
            {
                segmentNodeFlags[i] = new Configuration.SegmentNodeFlags[2];
            }
            initDone = true;
        }
Example #9
0
        public static void setEnterWhenBlockedAllowed(ushort segmentId, bool startNode, bool value)
        {
            bool?valueToSet = value;

            if (value == Options.allowEnterBlockedJunctions)
            {
                valueToSet = null;
            }

            int index = startNode ? 0 : 1;

            if (segmentNodeFlags[segmentId][index] == null)
            {
                if (valueToSet == null)
                {
                    return;
                }
                segmentNodeFlags[segmentId][index] = new Configuration.SegmentNodeFlags();
            }
            segmentNodeFlags[segmentId][index].enterWhenBlockedAllowed = valueToSet;
        }
Example #10
0
        public static void setStraightLaneChangingAllowed(ushort segmentId, bool startNode, bool value)
        {
            bool?valueToSet = value;

            if (value == Options.allowLaneChangesWhileGoingStraight)
            {
                valueToSet = null;
            }

            int index = startNode ? 0 : 1;

            if (segmentNodeFlags[segmentId][index] == null)
            {
                if (valueToSet == null)
                {
                    return;
                }
                segmentNodeFlags[segmentId][index] = new Configuration.SegmentNodeFlags();
            }
            segmentNodeFlags[segmentId][index].straightLaneChangingAllowed = valueToSet;
        }
Example #11
0
        public static void setPedestrianCrossingAllowed(ushort segmentId, bool startNode, bool value)
        {
            bool?valueToSet = value;

            if (value)
            {
                valueToSet = null;
            }

            int index = startNode ? 0 : 1;

            if (segmentNodeFlags[segmentId][index] == null)
            {
                if (valueToSet == null)
                {
                    return;
                }

                segmentNodeFlags[segmentId][index] = new Configuration.SegmentNodeFlags();
            }
            segmentNodeFlags[segmentId][index].pedestrianCrossingAllowed = valueToSet;
        }
Example #12
0
		public static void setStraightLaneChangingAllowed(ushort segmentId, bool startNode, bool value) {
			bool? valueToSet = value;
			if (value == Options.allowLaneChangesWhileGoingStraight)
				valueToSet = null;

			int index = startNode ? 0 : 1;
			if (segmentNodeFlags[segmentId][index] == null) {
				if (valueToSet == null)
					return;
				segmentNodeFlags[segmentId][index] = new Configuration.SegmentNodeFlags();
			}
			segmentNodeFlags[segmentId][index].straightLaneChangingAllowed = valueToSet;
		}
Example #13
0
        public static void resetSegmentNodeFlags(ushort segmentId, bool startNode)
        {
            int index = startNode ? 0 : 1;

            segmentNodeFlags[segmentId][index] = new Configuration.SegmentNodeFlags();
        }
Example #14
0
		public static void OnBeforeLoadData() {
			if (initDone)
				return;

			laneSpeedLimitArray = new ushort?[Singleton<NetManager>.instance.m_segments.m_size][];
			laneArrowFlags = new LaneArrows?[Singleton<NetManager>.instance.m_lanes.m_size];
			laneAllowedVehicleTypesArray = new ExtVehicleType?[Singleton<NetManager>.instance.m_segments.m_size][];
			highwayLaneArrowFlags = new LaneArrows?[Singleton<NetManager>.instance.m_lanes.m_size];
			nodeTrafficLightFlag = new bool?[Singleton<NetManager>.instance.m_nodes.m_size];
			segmentNodeFlags = new Configuration.SegmentNodeFlags[Singleton<NetManager>.instance.m_segments.m_size][];
			for (int i = 0; i < segmentNodeFlags.Length; ++i) {
				segmentNodeFlags[i] = new Configuration.SegmentNodeFlags[2];
			}
			initDone = true;
		}
Example #15
0
        public List <Configuration.SegmentNodeConf> SaveData(ref bool success)
        {
            List <Configuration.SegmentNodeConf> ret = new List <Configuration.SegmentNodeConf>();

            NetManager netManager = Singleton <NetManager> .instance;

            for (uint segmentId = 0; segmentId < NetManager.MAX_SEGMENT_COUNT; segmentId++)
            {
                try {
                    if (!Services.NetService.IsSegmentValid((ushort)segmentId))
                    {
                        continue;
                    }

                    ushort startNodeId = netManager.m_segments.m_buffer[segmentId].m_startNode;
                    ushort endNodeId   = netManager.m_segments.m_buffer[segmentId].m_endNode;

                    Configuration.SegmentNodeFlags startNodeFlags = Services.NetService.IsNodeValid(startNodeId) ? Flags.getSegmentNodeFlags((ushort)segmentId, true) : null;
                    Configuration.SegmentNodeFlags endNodeFlags   = Services.NetService.IsNodeValid(endNodeId) ? Flags.getSegmentNodeFlags((ushort)segmentId, false) : null;

                    if (startNodeFlags == null && endNodeFlags == null)
                    {
                        continue;
                    }

                    bool isDefaultConfiguration = true;
                    if (startNodeFlags != null)
                    {
                        if (!startNodeFlags.IsDefault())
                        {
                            isDefaultConfiguration = false;
                        }
                    }

                    if (endNodeFlags != null)
                    {
                        if (!endNodeFlags.IsDefault())
                        {
                            isDefaultConfiguration = false;
                        }
                    }

                    if (isDefaultConfiguration)
                    {
                        continue;
                    }

                    Configuration.SegmentNodeConf conf = new Configuration.SegmentNodeConf((ushort)segmentId);

                    conf.startNodeFlags = startNodeFlags;
                    conf.endNodeFlags   = endNodeFlags;

                    Log._Debug($"Saving segment-at-node flags for seg. {segmentId}");
                    ret.Add(conf);
                } catch (Exception e) {
                    Log.Error($"Exception occurred while saving segment node flags @ {segmentId}: {e.ToString()}");
                    success = false;
                }
            }
            return(ret);
        }
        public bool LoadData(List <Configuration.SegmentNodeConf> data)
        {
            bool success = true;

            Log.Info($"Loading junction restrictions. {data.Count} elements");
            foreach (Configuration.SegmentNodeConf segNodeConf in data)
            {
                try {
                    if (!Services.NetService.IsSegmentValid(segNodeConf.segmentId))
                    {
                        continue;
                    }

                    Log._Debug($"JunctionRestrictionsManager.LoadData: Loading junction restrictions for segment {segNodeConf.segmentId}: startNodeFlags={segNodeConf.startNodeFlags} endNodeFlags={segNodeConf.endNodeFlags}");

                    if (segNodeConf.startNodeFlags != null)
                    {
                        SegmentEndGeometry startNodeSegGeo = SegmentGeometry.Get(segNodeConf.segmentId)?.GetEnd(true);
                        if (startNodeSegGeo != null)
                        {
                            Configuration.SegmentNodeFlags flags = segNodeConf.startNodeFlags;

                            Services.NetService.ProcessNode(startNodeSegGeo.NodeId(), delegate(ushort nId, ref NetNode node) {
                                if (flags.uturnAllowed != null && IsUturnAllowedConfigurable(segNodeConf.segmentId, true, ref node))
                                {
                                    SetUturnAllowed(segNodeConf.segmentId, true, (bool)flags.uturnAllowed);
                                }

                                if (flags.turnOnRedAllowed != null && IsNearTurnOnRedAllowedConfigurable(segNodeConf.segmentId, true, ref node))
                                {
                                    SetNearTurnOnRedAllowed(segNodeConf.segmentId, true, (bool)flags.turnOnRedAllowed);
                                }

                                if (flags.farTurnOnRedAllowed != null && IsNearTurnOnRedAllowedConfigurable(segNodeConf.segmentId, true, ref node))
                                {
                                    SetFarTurnOnRedAllowed(segNodeConf.segmentId, true, (bool)flags.farTurnOnRedAllowed);
                                }

                                if (flags.straightLaneChangingAllowed != null && IsLaneChangingAllowedWhenGoingStraightConfigurable(segNodeConf.segmentId, true, ref node))
                                {
                                    SetLaneChangingAllowedWhenGoingStraight(segNodeConf.segmentId, true, (bool)flags.straightLaneChangingAllowed);
                                }

                                if (flags.enterWhenBlockedAllowed != null && IsEnteringBlockedJunctionAllowedConfigurable(segNodeConf.segmentId, true, ref node))
                                {
                                    SetEnteringBlockedJunctionAllowed(segNodeConf.segmentId, true, (bool)flags.enterWhenBlockedAllowed);
                                }

                                if (flags.pedestrianCrossingAllowed != null && IsPedestrianCrossingAllowedConfigurable(segNodeConf.segmentId, true, ref node))
                                {
                                    SetPedestrianCrossingAllowed(segNodeConf.segmentId, true, (bool)flags.pedestrianCrossingAllowed);
                                }

                                return(true);
                            });
                        }
                        else
                        {
                            Log.Warning($"JunctionRestrictionsManager.LoadData(): Could not get segment end geometry for segment {segNodeConf.segmentId} @ start node");
                        }
                    }

                    if (segNodeConf.endNodeFlags != null)
                    {
                        SegmentEndGeometry endNodeSegGeo = SegmentGeometry.Get(segNodeConf.segmentId)?.GetEnd(false);
                        if (endNodeSegGeo != null)
                        {
                            Configuration.SegmentNodeFlags flags = segNodeConf.endNodeFlags;

                            Services.NetService.ProcessNode(endNodeSegGeo.NodeId(), delegate(ushort nId, ref NetNode node) {
                                if (flags.uturnAllowed != null && IsUturnAllowedConfigurable(segNodeConf.segmentId, false, ref node))
                                {
                                    SetUturnAllowed(segNodeConf.segmentId, false, (bool)flags.uturnAllowed);
                                }

                                if (flags.straightLaneChangingAllowed != null && IsLaneChangingAllowedWhenGoingStraightConfigurable(segNodeConf.segmentId, false, ref node))
                                {
                                    SetLaneChangingAllowedWhenGoingStraight(segNodeConf.segmentId, false, (bool)flags.straightLaneChangingAllowed);
                                }

                                if (flags.enterWhenBlockedAllowed != null && IsEnteringBlockedJunctionAllowedConfigurable(segNodeConf.segmentId, false, ref node))
                                {
                                    SetEnteringBlockedJunctionAllowed(segNodeConf.segmentId, false, (bool)flags.enterWhenBlockedAllowed);
                                }

                                if (flags.pedestrianCrossingAllowed != null && IsPedestrianCrossingAllowedConfigurable(segNodeConf.segmentId, false, ref node))
                                {
                                    SetPedestrianCrossingAllowed(segNodeConf.segmentId, false, (bool)flags.pedestrianCrossingAllowed);
                                }

                                if (flags.turnOnRedAllowed != null)
                                {
                                    SetNearTurnOnRedAllowed(segNodeConf.segmentId, false, (bool)flags.turnOnRedAllowed);
                                }

                                if (flags.farTurnOnRedAllowed != null)
                                {
                                    SetFarTurnOnRedAllowed(segNodeConf.segmentId, false, (bool)flags.farTurnOnRedAllowed);
                                }
                                return(true);
                            });
                        }
                        else
                        {
                            Log.Warning($"JunctionRestrictionsManager.LoadData(): Could not get segment end geometry for segment {segNodeConf.segmentId} @ end node");
                        }
                    }
                } catch (Exception e) {
                    // ignore, as it's probably corrupt save data. it'll be culled on next save
                    Log.Warning($"Error loading junction restrictions @ segment {segNodeConf.segmentId}: " + e.ToString());
                    success = false;
                }
            }
            return(success);
        }
        public List <Configuration.SegmentNodeConf> SaveData(ref bool success)
        {
            List <Configuration.SegmentNodeConf> ret = new List <Configuration.SegmentNodeConf>();

            NetManager netManager = Singleton <NetManager> .instance;

            for (uint segmentId = 0; segmentId < NetManager.MAX_SEGMENT_COUNT; segmentId++)
            {
                try {
                    if (!Services.NetService.IsSegmentValid((ushort)segmentId))
                    {
                        continue;
                    }

                    Configuration.SegmentNodeFlags startNodeFlags = null;
                    Configuration.SegmentNodeFlags endNodeFlags   = null;

                    ushort startNodeId = netManager.m_segments.m_buffer[segmentId].m_startNode;
                    if (Services.NetService.IsNodeValid(startNodeId))
                    {
                        SegmentEndFlags endFlags = SegmentFlags[segmentId].startNodeFlags;

                        if (!endFlags.IsDefault())
                        {
                            startNodeFlags = new Configuration.SegmentNodeFlags();

                            startNodeFlags.uturnAllowed = TernaryBoolUtil.ToOptBool(GetUturnAllowed((ushort)segmentId, true));
                            startNodeFlags.straightLaneChangingAllowed = TernaryBoolUtil.ToOptBool(GetLaneChangingAllowedWhenGoingStraight((ushort)segmentId, true));
                            startNodeFlags.enterWhenBlockedAllowed     = TernaryBoolUtil.ToOptBool(GetEnteringBlockedJunctionAllowed((ushort)segmentId, true));
                            startNodeFlags.pedestrianCrossingAllowed   = TernaryBoolUtil.ToOptBool(GetPedestrianCrossingAllowed((ushort)segmentId, true));
                        }
                    }

                    ushort endNodeId = netManager.m_segments.m_buffer[segmentId].m_endNode;
                    if (Services.NetService.IsNodeValid(endNodeId))
                    {
                        SegmentEndFlags endFlags = SegmentFlags[segmentId].endNodeFlags;

                        if (!endFlags.IsDefault())
                        {
                            endNodeFlags = new Configuration.SegmentNodeFlags();

                            endNodeFlags.uturnAllowed = TernaryBoolUtil.ToOptBool(GetUturnAllowed((ushort)segmentId, false));
                            endNodeFlags.straightLaneChangingAllowed = TernaryBoolUtil.ToOptBool(GetLaneChangingAllowedWhenGoingStraight((ushort)segmentId, false));
                            endNodeFlags.enterWhenBlockedAllowed     = TernaryBoolUtil.ToOptBool(GetEnteringBlockedJunctionAllowed((ushort)segmentId, false));
                            endNodeFlags.pedestrianCrossingAllowed   = TernaryBoolUtil.ToOptBool(GetPedestrianCrossingAllowed((ushort)segmentId, false));
                        }
                    }

                    if (startNodeFlags == null && endNodeFlags == null)
                    {
                        continue;
                    }

                    Configuration.SegmentNodeConf conf = new Configuration.SegmentNodeConf((ushort)segmentId);

                    conf.startNodeFlags = startNodeFlags;
                    conf.endNodeFlags   = endNodeFlags;

                    Log._Debug($"Saving segment-at-node flags for seg. {segmentId}");
                    ret.Add(conf);
                } catch (Exception e) {
                    Log.Error($"Exception occurred while saving segment node flags @ {segmentId}: {e.ToString()}");
                    success = false;
                }
            }
            return(ret);
        }
        public bool LoadData(List <Configuration.SegmentNodeConf> data)
        {
            bool success = true;

            Log.Info($"Loading junction restrictions. {data.Count} elements");
            foreach (Configuration.SegmentNodeConf segNodeConf in data)
            {
                try {
                    if (!Services.NetService.IsSegmentValid(segNodeConf.segmentId))
                    {
                        continue;
                    }

                    if (segNodeConf.startNodeFlags != null)
                    {
                        Configuration.SegmentNodeFlags flags = segNodeConf.startNodeFlags;
                        if (flags.uturnAllowed != null)
                        {
                            SetUturnAllowed(segNodeConf.segmentId, true, (bool)flags.uturnAllowed);
                        }

                        if (flags.straightLaneChangingAllowed != null)
                        {
                            SetLaneChangingAllowedWhenGoingStraight(segNodeConf.segmentId, true, (bool)flags.straightLaneChangingAllowed);
                        }

                        if (flags.enterWhenBlockedAllowed != null)
                        {
                            SetEnteringBlockedJunctionAllowed(segNodeConf.segmentId, true, (bool)flags.enterWhenBlockedAllowed);
                        }

                        if (flags.pedestrianCrossingAllowed != null)
                        {
                            SetPedestrianCrossingAllowed(segNodeConf.segmentId, true, (bool)flags.pedestrianCrossingAllowed);
                        }
                    }

                    if (segNodeConf.endNodeFlags != null)
                    {
                        Configuration.SegmentNodeFlags flags = segNodeConf.endNodeFlags;
                        if (flags.uturnAllowed != null)
                        {
                            SetUturnAllowed(segNodeConf.segmentId, false, (bool)flags.uturnAllowed);
                        }

                        if (flags.straightLaneChangingAllowed != null)
                        {
                            SetLaneChangingAllowedWhenGoingStraight(segNodeConf.segmentId, false, (bool)flags.straightLaneChangingAllowed);
                        }

                        if (flags.enterWhenBlockedAllowed != null)
                        {
                            SetEnteringBlockedJunctionAllowed(segNodeConf.segmentId, false, (bool)flags.enterWhenBlockedAllowed);
                        }

                        if (flags.pedestrianCrossingAllowed != null)
                        {
                            SetPedestrianCrossingAllowed(segNodeConf.segmentId, false, (bool)flags.pedestrianCrossingAllowed);
                        }
                    }
                } catch (Exception e) {
                    // ignore, as it's probably corrupt save data. it'll be culled on next save
                    Log.Warning($"Error loading junction restrictions @ segment {segNodeConf.segmentId}: " + e.ToString());
                    success = false;
                }
            }
            return(success);
        }
Example #19
0
		public static void setEnterWhenBlockedAllowed(ushort segmentId, bool startNode, bool value) {
			bool? valueToSet = value;
			if (value == Options.allowEnterBlockedJunctions)
				valueToSet = null;

			int index = startNode ? 0 : 1;
			if (segmentNodeFlags[segmentId][index] == null) {
				if (valueToSet == null)
					return;
				segmentNodeFlags[segmentId][index] = new Configuration.SegmentNodeFlags();
			}
			segmentNodeFlags[segmentId][index].enterWhenBlockedAllowed = valueToSet;
		}