// ================================ /// <summary>Call this function to reset the game</summary> /// <param name="ResetLogs">Whether the logs should be reset</param> internal static void Reset(bool ResetLogs) { // track manager for (int i = 0; i < TrackManager.Tracks.Length; i++) { TrackManager.Tracks[i] = new TrackManager.Track(); } // train manager TrainManager.Trains = new TrainManager.Train[] { }; // game Interface.ClearMessages(); CurrentInterface = InterfaceType.Normal; RouteComment = ""; RouteImage = ""; RouteAccelerationDueToGravity = 9.80665; RouteRailGauge = 1.435; RouteInitialAirPressure = 101325.0; RouteInitialAirTemperature = 293.15; RouteInitialElevation = 0.0; RouteSeaLevelAirPressure = 101325.0; RouteSeaLevelAirTemperature = 293.15; Stations = new Station[] { }; Sections = new Section[] { }; BufferTrackPositions = new double[] { }; //Messages = new Message[] { }; MarkerTextures = new Texture[] { }; PointsOfInterest = new PointOfInterest[] { }; PrecedingTrainTimeDeltas = new double[] { }; PrecedingTrainSpeedLimit = double.PositiveInfinity; BogusPretrainInstructions = new BogusPretrainInstruction[] { }; TrainName = ""; TrainStart = TrainStartMode.EmergencyBrakesNoAts; NoFogStart = (float)Math.Max(1.33333333333333 * Interface.CurrentOptions.ViewingDistance, 800.0); NoFogEnd = (float)Math.Max(2.66666666666667 * Interface.CurrentOptions.ViewingDistance, 1600.0); PreviousFog = new Fog(NoFogStart, NoFogEnd, Color24.Grey, 0.0); CurrentFog = new Fog(NoFogStart, NoFogEnd, Color24.Grey, 0.5); NextFog = new Fog(NoFogStart, NoFogEnd, Color24.Grey, 1.0); InfoTotalTriangles = 0; InfoTotalTriangleStrip = 0; InfoTotalQuads = 0; InfoTotalQuadStrip = 0; InfoTotalPolygon = 0; InfoStaticOpaqueFaceCount = 0; if (ResetLogs) { LogRouteName = ""; LogTrainName = ""; LogDateTime = DateTime.Now; CurrentScore = new Score(); ScoreMessages = new ScoreMessage[] { }; ScoreLogs = new ScoreLog[64]; ScoreLogCount = 0; BlackBoxEntries = new BlackBoxEntry[256]; BlackBoxEntryCount = 0; BlackBoxNextUpdate = 0.0; } // renderer Renderer.Reset(); }
// ================================ internal static void Reset() { // game Interface.ClearMessages(); RouteComment = ""; BogusPretrainInstructions = new BogusPretrainInstruction[] { }; // renderer / sound // Renderer.Reset(); // SoundManager.StopAllSounds(true); GC.Collect(); }
// ================================ internal static void Reset() { // track manager TrackManager.CurrentTrack = new TrackManager.Track(); // train manager TrainManager.Trains = new TrainManager.Train[] { }; // game Interface.ClearMessages(); RouteComment = ""; RouteImage = ""; RouteAccelerationDueToGravity = 9.80665; RouteRailGauge = 1.435; RouteInitialAirPressure = 101325.0; RouteInitialAirTemperature = 293.15; RouteInitialElevation = 0.0; RouteSeaLevelAirPressure = 101325.0; RouteSeaLevelAirTemperature = 293.15; Stations = new Station[] { }; Sections = new Section[] { }; BufferTrackPositions = new double[] { }; MarkerTextures = new int[] { }; PointsOfInterest = new PointOfInterest[] { }; BogusPretrainInstructions = new BogusPretrainInstruction[] { }; TrainName = ""; TrainStart = TrainStartMode.EmergencyBrakesNoAts; PreviousFog = new Fog(0.0f, 0.0f, new Color24(128, 128, 128), 0.0); CurrentFog = new Fog(0.0f, 0.0f, new Color24(128, 128, 128), 0.5); NextFog = new Fog(0.0f, 0.0f, new Color24(128, 128, 128), 1.0); NoFogStart = (float)World.BackgroundImageDistance + 200.0f; NoFogEnd = 2.0f * NoFogStart; InfoTotalTriangles = 0; InfoTotalTriangleStrip = 0; InfoTotalQuads = 0; InfoTotalQuadStrip = 0; InfoTotalPolygon = 0; // object manager ObjectManager.Objects = new ObjectManager.StaticObject[16]; ObjectManager.ObjectsUsed = 0; ObjectManager.ObjectsSortedByStart = new int[] { }; ObjectManager.ObjectsSortedByEnd = new int[] { }; ObjectManager.ObjectsSortedByStartPointer = 0; ObjectManager.ObjectsSortedByEndPointer = 0; ObjectManager.LastUpdatedTrackPosition = 0.0; ObjectManager.AnimatedWorldObjects = new ObjectManager.AnimatedWorldObject[4]; ObjectManager.AnimatedWorldObjectsUsed = 0; // renderer / sound Renderer.Reset(); SoundManager.StopAllSounds(true); GC.Collect(); }
// ================================ internal static void Reset() { // track manager TrackManager.CurrentTrack = new TrackManager.Track(); // train manager TrainManager.Trains = new TrainManager.Train[] { }; // game Interface.ClearMessages(); RouteComment = ""; RouteImage = ""; RouteAccelerationDueToGravity = 9.80665; RouteRailGauge = 1.435; RouteInitialAirPressure = 101325.0; RouteInitialAirTemperature = 293.15; RouteInitialElevation = 0.0; RouteSeaLevelAirPressure = 101325.0; RouteSeaLevelAirTemperature = 293.15; Stations = new Station[] { }; Sections = new Section[] { }; BufferTrackPositions = new double[] { }; MarkerTextures = new int[] { }; PointsOfInterest = new PointOfInterest[] { }; BogusPretrainInstructions = new BogusPretrainInstruction[] { }; TrainName = ""; TrainStart = TrainStartMode.EmergencyBrakesNoAts; PreviousFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 0.0); CurrentFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 0.5); NextFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 1.0); NoFogStart = (float)World.BackgroundImageDistance + 200.0f; NoFogEnd = 2.0f * NoFogStart; InfoTotalTriangles = 0; InfoTotalTriangleStrip = 0; InfoTotalQuads = 0; InfoTotalQuadStrip = 0; InfoTotalPolygon = 0; // object manager ObjectManager.Objects = new ObjectManager.StaticObject[16]; ObjectManager.ObjectsUsed = 0; ObjectManager.ObjectsSortedByStart = new int[] { }; ObjectManager.ObjectsSortedByEnd = new int[] { }; ObjectManager.ObjectsSortedByStartPointer = 0; ObjectManager.ObjectsSortedByEndPointer = 0; ObjectManager.LastUpdatedTrackPosition = 0.0; ObjectManager.AnimatedWorldObjects = new ObjectManager.AnimatedWorldObject[4]; ObjectManager.AnimatedWorldObjectsUsed = 0; // renderer / sound Renderer.Reset(); SoundManager.StopAllSounds(true); GC.Collect(); }