setAdvancedAI() public static method

public static setAdvancedAI ( bool newAdvancedAI ) : void
newAdvancedAI bool
return void
        public override void OnLoadData()
        {
            Log.Info("Loading Traffic Manager: PE Data");
            StateLoading = true;
            try {
                Log.Info("Initializing flags");
                Flags.OnBeforeLoadData();
                Log.Info("Initializing node geometries");
                NodeGeometry.OnBeforeLoadData();
                Log.Info("Initializing segment geometries");
                SegmentGeometry.OnBeforeLoadData();
                Log.Info("Initializing lane connection manager");
                Singleton <LaneConnectionManager> .instance.OnBeforeLoadData();               // requires segment geometries

                Log.Info("Initializing CustomRoadAI");
                CustomRoadAI.OnBeforeLoadData();
                Log.Info("Initialization done. Loading mod data now.");
                byte[] data = _serializableData.LoadData(DataId);
                DeserializeData(data);

                // load options
                byte[] options = _serializableData.LoadData("TMPE_Options");
                if (options != null)
                {
                    if (options.Length >= 1)
                    {
                        Options.setSimAccuracy(options[0]);
                    }

                    if (options.Length >= 2)
                    {
                        //Options.setLaneChangingRandomization(options[1]);
                    }

                    if (options.Length >= 3)
                    {
                        Options.setRecklessDrivers(options[2]);
                    }

                    if (options.Length >= 4)
                    {
                        Options.setRelaxedBusses(options[3] == (byte)1);
                    }

                    if (options.Length >= 5)
                    {
                        Options.setNodesOverlay(options[4] == (byte)1);
                    }

                    if (options.Length >= 6)
                    {
                        Options.setMayEnterBlockedJunctions(options[5] == (byte)1);
                    }

                    if (options.Length >= 7)
                    {
#if !TAM
                        if (!LoadingExtension.IsPathManagerCompatible)
                        {
                            Options.setAdvancedAI(false);
                        }
                        else
                        {
#endif
                        Options.setAdvancedAI(options[6] == (byte)1);
#if !TAM
                    }
#endif
                    }

                    if (options.Length >= 8)
                    {
                        Options.setHighwayRules(options[7] == (byte)1);
                    }

                    if (options.Length >= 9)
                    {
                        Options.setPrioritySignsOverlay(options[8] == (byte)1);
                    }

                    if (options.Length >= 10)
                    {
                        Options.setTimedLightsOverlay(options[9] == (byte)1);
                    }

                    if (options.Length >= 11)
                    {
                        Options.setSpeedLimitsOverlay(options[10] == (byte)1);
                    }

                    if (options.Length >= 12)
                    {
                        Options.setVehicleRestrictionsOverlay(options[11] == (byte)1);
                    }

                    if (options.Length >= 13)
                    {
                        Options.setStrongerRoadConditionEffects(options[12] == (byte)1);
                    }

                    if (options.Length >= 14)
                    {
                        Options.setAllowUTurns(options[13] == (byte)1);
                    }

                    if (options.Length >= 15)
                    {
                        Options.setAllowLaneChangesWhileGoingStraight(options[14] == (byte)1);
                    }

                    if (options.Length >= 16)
                    {
                        Options.setEnableDespawning(options[15] == (byte)1);
                    }

                    if (options.Length >= 17)
                    {
                        Options.setDynamicPathRecalculation(options[16] == (byte)1);
                    }

                    if (options.Length >= 18)
                    {
                        Options.setConnectedLanesOverlay(options[17] == (byte)1);
                    }
                }
            } catch (Exception e) {
                Log.Error($"OnLoadData: {e.ToString()}");
            } finally {
                StateLoading = false;
            }

            Log.Info("OnLoadData completed.");

            // load toggled traffic lights
            //byte[] trafficLight = _serializableData.LoadData("TMPE_Options");
        }
        public override void OnLoadData()
        {
            Log.Info("Loading Traffic Manager: PE Data");
            StateLoading = true;
            bool loadingSucceeded = true;

            try {
                Log.Info("Initializing flags");
                Flags.OnBeforeLoadData();
            } catch (Exception e) {
                Log.Error($"OnLoadData: Error while initializing Flags: {e.ToString()}");
                loadingSucceeded = false;
            }

            try {
                Log.Info("Initializing node geometries");
                NodeGeometry.OnBeforeLoadData();
            } catch (Exception e) {
                Log.Error($"OnLoadData: Error while initializing NodeGeometry: {e.ToString()}");
                loadingSucceeded = false;
            }

            try {
                Log.Info("Initializing segment geometries");
                SegmentGeometry.OnBeforeLoadData();
            } catch (Exception e) {
                Log.Error($"OnLoadData: Error while initializing SegmentGeometry: {e.ToString()}");
                loadingSucceeded = false;
            }

            try {
                Log.Info("Initializing lane connection manager");
                LaneConnectionManager.Instance().OnBeforeLoadData();                 // requires segment geometries
            } catch (Exception e) {
                Log.Error($"OnLoadData: Error while initializing LaneConnectionManager: {e.ToString()}");
                loadingSucceeded = false;
            }

            try {
                Log.Info("Initializing CustomRoadAI");
                CustomRoadAI.OnBeforeLoadData();
            } catch (Exception e) {
                Log.Error($"OnLoadData: Error while initializing CustomRoadAI: {e.ToString()}");
                loadingSucceeded = false;
            }

            Log.Info("Initialization done. Loading mod data now.");

            try {
                byte[] data = _serializableData.LoadData(DataId);
                DeserializeData(data);
            } catch (Exception e) {
                Log.Error($"OnLoadData: Error while deserializing data: {e.ToString()}");
                loadingSucceeded = false;
            }

            // load options
            try {
                byte[] options = _serializableData.LoadData("TMPE_Options");
                if (options != null)
                {
                    if (options.Length >= 1)
                    {
                        Options.setSimAccuracy(options[0]);
                    }

                    if (options.Length >= 2)
                    {
                        //Options.setLaneChangingRandomization(options[1]);
                    }

                    if (options.Length >= 3)
                    {
                        Options.setRecklessDrivers(options[2]);
                    }

                    if (options.Length >= 4)
                    {
                        Options.setRelaxedBusses(options[3] == (byte)1);
                    }

                    if (options.Length >= 5)
                    {
                        Options.setNodesOverlay(options[4] == (byte)1);
                    }

                    if (options.Length >= 6)
                    {
                        Options.setMayEnterBlockedJunctions(options[5] == (byte)1);
                    }

                    if (options.Length >= 7)
                    {
#if !TAM
                        if (!LoadingExtension.IsPathManagerCompatible)
                        {
                            Options.setAdvancedAI(false);
                        }
                        else
                        {
#endif
                        Options.setAdvancedAI(options[6] == (byte)1);
#if !TAM
                    }
#endif
                    }

                    if (options.Length >= 8)
                    {
                        Options.setHighwayRules(options[7] == (byte)1);
                    }

                    if (options.Length >= 9)
                    {
                        Options.setPrioritySignsOverlay(options[8] == (byte)1);
                    }

                    if (options.Length >= 10)
                    {
                        Options.setTimedLightsOverlay(options[9] == (byte)1);
                    }

                    if (options.Length >= 11)
                    {
                        Options.setSpeedLimitsOverlay(options[10] == (byte)1);
                    }

                    if (options.Length >= 12)
                    {
                        Options.setVehicleRestrictionsOverlay(options[11] == (byte)1);
                    }

                    if (options.Length >= 13)
                    {
                        Options.setStrongerRoadConditionEffects(options[12] == (byte)1);
                    }

                    if (options.Length >= 14)
                    {
                        Options.setAllowUTurns(options[13] == (byte)1);
                    }

                    if (options.Length >= 15)
                    {
                        Options.setAllowLaneChangesWhileGoingStraight(options[14] == (byte)1);
                    }

                    if (options.Length >= 16)
                    {
                        Options.setEnableDespawning(options[15] == (byte)1);
                    }

                    if (options.Length >= 17)
                    {
                        Options.setDynamicPathRecalculation(options[16] == (byte)1);
                    }

                    if (options.Length >= 18)
                    {
                        Options.setConnectedLanesOverlay(options[17] == (byte)1);
                    }

                    if (options.Length >= 19)
                    {
                        Options.setPrioritySignsEnabled(options[18] == (byte)1);
                    }

                    if (options.Length >= 20)
                    {
                        Options.setTimedLightsEnabled(options[19] == (byte)1);
                    }

                    if (options.Length >= 21)
                    {
                        Options.setCustomSpeedLimitsEnabled(options[20] == (byte)1);
                    }

                    if (options.Length >= 22)
                    {
                        Options.setVehicleRestrictionsEnabled(options[21] == (byte)1);
                    }

                    if (options.Length >= 23)
                    {
                        Options.setLaneConnectorEnabled(options[22] == (byte)1);
                    }

                    if (options.Length >= 24)
                    {
                        Options.setJunctionRestrictionsOverlay(options[23] == (byte)1);
                    }

                    if (options.Length >= 25)
                    {
                        Options.setJunctionRestrictionsEnabled(options[24] == (byte)1);
                    }
                }
            } catch (Exception e) {
                Log.Error($"OnLoadData: Error while loading options: {e.ToString()}");
                loadingSucceeded = false;
            }

            if (loadingSucceeded)
            {
                Log.Info("OnLoadData completed successfully.");
            }
            else
            {
                Log.Info("An error occurred while loading.");
                //UIView.library.ShowModal<ExceptionPanel>("ExceptionPanel").SetMessage("An error occurred while loading", "Traffic Manager: President Edition detected an error while loading. Please do NOT save this game under the old filename, otherwise your timed traffic lights, custom lane arrows, etc. are in danger. Instead, please navigate to http://steamcommunity.com/sharedfiles/filedetails/?id=583429740 and follow the steps under 'In case problems arise'.", true);
            }
            StateLoading = false;
        }