Ejemplo n.º 1
0
        // ================================

        /// <summary>Call this function to reset the game</summary>
        /// <param name="ResetLogs">Whether the logs should be reset</param>
        /// <param name="ResetRenderer">Whether the renderer should be reset</param>
        internal static void Reset(bool ResetLogs, bool ResetRenderer)
        {
            // track manager
            for (int i = 0; i < Program.CurrentRoute.Tracks.Count; i++)
            {
                int key = Program.CurrentRoute.Tracks.ElementAt(i).Key;
                Program.CurrentRoute.Tracks[key] = new Track();
            }
            // train manager
            TrainManager.Trains = new TrainManager.Train[] { };
            // game
            Interface.ClearMessages();
            CurrentInterface             = InterfaceType.Normal;
            Program.CurrentRoute.Comment = "";
            Program.CurrentRoute.Image   = "";
            Program.CurrentRoute.Atmosphere.AccelerationDueToGravity = 9.80665;
            Program.CurrentRoute.Atmosphere.InitialAirPressure       = 101325.0;
            Program.CurrentRoute.Atmosphere.InitialAirTemperature    = 293.15;
            Program.CurrentRoute.Atmosphere.InitialElevation         = 0.0;
            Program.CurrentRoute.Atmosphere.SeaLevelAirPressure      = 101325.0;
            Program.CurrentRoute.Atmosphere.SeaLevelAirTemperature   = 293.15;
            Program.CurrentRoute.BufferTrackPositions = new double[] { };
            //Messages = new Message[] { };
            Program.Renderer.Marker.MarkerTextures = new Texture[] { };
            Program.CurrentRoute.PointsOfInterest  = new PointOfInterest[] { };
            PrecedingTrainTimeDeltas = new double[] { };
            PrecedingTrainSpeedLimit = double.PositiveInfinity;
            Program.CurrentRoute.BogusPreTrainInstructions = new BogusPreTrainInstruction[] { };
            TrainName  = "";
            TrainStart = TrainStartMode.EmergencyBrakesNoAts;
            Program.CurrentRoute.NoFogStart  = (float)Math.Max(1.33333333333333 * Interface.CurrentOptions.ViewingDistance, 800.0);
            Program.CurrentRoute.NoFogEnd    = (float)Math.Max(2.66666666666667 * Interface.CurrentOptions.ViewingDistance, 1600.0);
            Program.CurrentRoute.PreviousFog = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 0.0);
            Program.CurrentRoute.CurrentFog  = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 0.5);
            Program.CurrentRoute.NextFog     = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 1.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
            if (ResetRenderer)
            {
                Program.Renderer.InfoTotalTriangles     = 0;
                Program.Renderer.InfoTotalTriangleStrip = 0;
                Program.Renderer.InfoTotalQuads         = 0;
                Program.Renderer.InfoTotalQuadStrip     = 0;
                Program.Renderer.InfoTotalPolygon       = 0;
                Program.Renderer.Reset();
            }
        }
Ejemplo n.º 2
0
        // ================================

        /// <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 RouteStation[] { };
            CurrentRoute.Sections = new Section[] { };
            BufferTrackPositions  = new double[] { };
            //Messages = new Message[] { };
            MarkerTextures           = new Texture[] { };
            PointsOfInterest         = new PointOfInterest[] { };
            PrecedingTrainTimeDeltas = new double[] { };
            PrecedingTrainSpeedLimit = double.PositiveInfinity;
            CurrentRoute.BogusPretrainInstructions = new BogusPretrainInstruction[] { };
            TrainName  = "";
            TrainStart = TrainStartMode.EmergencyBrakesNoAts;
            CurrentRoute.NoFogStart   = (float)Math.Max(1.33333333333333 * Interface.CurrentOptions.ViewingDistance, 800.0);
            CurrentRoute.NoFogEnd     = (float)Math.Max(2.66666666666667 * Interface.CurrentOptions.ViewingDistance, 1600.0);
            CurrentRoute.PreviousFog  = new Fog(CurrentRoute.NoFogStart, CurrentRoute.NoFogEnd, Color24.Grey, 0.0);
            CurrentRoute.CurrentFog   = new Fog(CurrentRoute.NoFogStart, CurrentRoute.NoFogEnd, Color24.Grey, 0.5);
            CurrentRoute.NextFog      = new Fog(CurrentRoute.NoFogStart, CurrentRoute.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();
        }
Ejemplo n.º 3
0
        /// <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 < Program.CurrentRoute.Tracks.Count; i++)
            {
                int key = Program.CurrentRoute.Tracks.ElementAt(i).Key;
                Program.CurrentRoute.Tracks[key] = new Track();
            }
            // train manager
            Program.TrainManager.Trains = new TrainBase[] { };
            // game
            Interface.LogMessages.Clear();
            Program.CurrentHost.MissingFiles.Clear();
            if (Program.Renderer.CurrentInterface != InterfaceType.Menu)
            {
                Program.Renderer.CurrentInterface = InterfaceType.Normal;
            }

            Program.CurrentRoute.Comment              = "";
            Program.CurrentRoute.Image                = "";
            Program.CurrentRoute.Atmosphere           = new Atmosphere();
            Program.CurrentRoute.LightDefinitions     = new LightDefinition[] { };
            Program.CurrentRoute.BufferTrackPositions = new double[] { };
            //Messages = new Message[] { };
            Program.Renderer.Marker.MarkerTextures            = new Texture[] { };
            Program.CurrentRoute.PointsOfInterest             = new PointOfInterest[] { };
            Program.CurrentRoute.PrecedingTrainTimeDeltas     = new double[] { };
            Interface.CurrentOptions.PrecedingTrainSpeedLimit = double.PositiveInfinity;
            Program.CurrentRoute.BogusPreTrainInstructions    = new BogusPreTrainInstruction[] { };
            Interface.CurrentOptions.TrainName  = "";
            Interface.CurrentOptions.TrainStart = TrainStartMode.EmergencyBrakesNoAts;
            Program.CurrentRoute.NoFogStart     = (float)Math.Max(1.33333333333333 * Interface.CurrentOptions.ViewingDistance, 800.0);
            Program.CurrentRoute.NoFogEnd       = (float)Math.Max(2.66666666666667 * Interface.CurrentOptions.ViewingDistance, 1600.0);
            Program.CurrentRoute.PreviousFog    = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 0.0);
            Program.CurrentRoute.CurrentFog     = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 0.5);
            Program.CurrentRoute.NextFog        = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 1.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;
            }
        }
Ejemplo n.º 4
0
		// ================================

		internal static void Reset(bool ResetLogs) {
			// track manager
			TrackManager.CurrentTrack = new TrackManager.Track();
			// train manager
			TrainManager.Trains = new TrainManager.Train[] { };
			// game
			Debug.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 Textures.Texture[] { };
			PointsOfInterest = new PointOfInterest[] { };
			PrecedingTrainTimeDeltas = new double[] { };
			PrecedingTrainSpeedLimit = double.PositiveInfinity;
			BogusPretrainInstructions = new BogusPretrainInstruction[] { };
			TrainName = "";
			TrainStart = TrainStartMode.EmergencyBrakesNoAts;
			NoFogStart = (float)Math.Max(1.33333333333333 * Options.Current.ViewingDistance, 800.0);
			NoFogEnd = (float)Math.Max(2.66666666666667 * Options.Current.ViewingDistance, 1600.0);
			PreviousFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.0);
			CurrentFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.5);
			NextFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 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();
		}