Skip to content

Commit 86bcd3a

Browse files
Merge branch 'master' into downloadContent2
2 parents 3b7b1b6 + 58b2418 commit 86bcd3a

File tree

81 files changed

+2642
-873
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2642
-873
lines changed

Source/ContentChecker/ContentChecker.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
<TargetFramework Condition="'$(BuildDotNet)' == 'true'">net6-windows</TargetFramework>
44
<TargetFramework Condition="'$(TargetFramework)' == ''">net472</TargetFramework>
55
<OutputType>Exe</OutputType>
6-
<UseWindowsForms>true</UseWindowsForms>
7-
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
86
<IsPublishable>False</IsPublishable>
97
<AssemblyTitle>Open Rails Content Checker</AssemblyTitle>
108
<Description>Open Rails Transport Simulator</Description>

Source/ContentChecker/Loader.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
using System.Linq;
4444
using System.Text;
4545
using Microsoft.Xna.Framework.Graphics;
46-
using System.Windows.Forms;
4746

4847
namespace ContentChecker
4948
{
@@ -70,7 +69,7 @@ abstract class Loader
7069
/// <summary> The number of files that were actually loaded </summary>
7170
public int FilesLoaded { get; protected set; }
7271
/// <summary> The number of files that were not loaded but skipped </summary>
73-
public int FilesSkipped {get; protected set;}
72+
public int FilesSkipped { get; protected set; }
7473

7574
/// <summary> The action to take when an additonal file has been identified. This is intended to be set externally </summary>
7675
protected Action<string, Loader> AddAdditionalFileAction { get; set; }
@@ -158,17 +157,13 @@ protected static GraphicsDevice GetGraphicsDevice()
158157
{
159158
if (_graphicsDevice == null)
160159
{
161-
// We use a Windows.Forms Control instead of an xna GAME because it is much easier to use.
162-
var _c = new Control();
163-
164160
// Details probably do not matter too much
165161
PresentationParameters parameters = new PresentationParameters()
166162
{
167163
BackBufferWidth = 100,
168164
BackBufferHeight = 100,
169165
BackBufferFormat = SurfaceFormat.Color,
170166
//DepthStencilFormat = DepthFormat.Depth24,
171-
DeviceWindowHandle = _c.Handle,
172167
PresentationInterval = PresentInterval.Immediate,
173168
IsFullScreen = false,
174169
};

Source/ContentChecker/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,10 @@ static bool OptionsContain(string[] args, IEnumerable<string> optionNames) {
7777
/// </summary>
7878
static void ShowHelp()
7979
{
80-
var version = FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.Location);
81-
Console.WriteLine("{0} {1}", version.FileDescription, VersionInfo.VersionOrBuild);
80+
Console.WriteLine("{0} {1}", ApplicationInfo.ApplicationName, VersionInfo.VersionOrBuild);
8281
Console.WriteLine();
8382
Console.WriteLine("Usage:");
84-
Console.WriteLine(" {0} [options] <FILE> [...]", Path.GetFileNameWithoutExtension(version.FileName));
83+
Console.WriteLine(" {0} [options] <FILE> [...]", Path.GetFileNameWithoutExtension(ApplicationInfo.ProcessFile));
8584
Console.WriteLine();
8685
Console.WriteLine("Arguments:");
8786
Console.WriteLine(" <FILE> Data files to check; may contain wildcards");

Source/Contrib/DataCollector/Program.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using ORTS.Common;
2020
using System;
2121
using System.Collections.Generic;
22-
using System.Diagnostics;
2322
using System.IO;
2423
using System.Linq;
2524

@@ -39,11 +38,10 @@ static void Main(string[] args)
3938

4039
static void ShowHelp()
4140
{
42-
var version = FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.Location);
43-
Console.WriteLine("{0} {1}", version.FileDescription, VersionInfo.VersionOrBuild);
41+
Console.WriteLine("{0} {1}", ApplicationInfo.ApplicationName, VersionInfo.VersionOrBuild);
4442
Console.WriteLine();
4543
Console.WriteLine("Usage:");
46-
Console.WriteLine(" {0} [options] [<PATH> [...]]", Path.GetFileNameWithoutExtension(version.FileName));
44+
Console.WriteLine(" {0} [options] [<PATH> [...]]", Path.GetFileNameWithoutExtension(ApplicationInfo.ProcessFile));
4745
Console.WriteLine();
4846
Console.WriteLine("Arguments:");
4947
Console.WriteLine(" <PATH> Directories to scan for specific options");

Source/Contrib/DataConverter/Program.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
using System;
1919
using System.Collections.Generic;
20-
using System.Diagnostics;
2120
using System.IO;
2221
using System.Linq;
2322
using System.Runtime.Serialization;
@@ -87,11 +86,10 @@ static void Main(string[] args)
8786

8887
static void ShowHelp(List<IDataConverter> converters)
8988
{
90-
var version = FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.Location);
91-
Console.WriteLine("{0} {1}", version.FileDescription, VersionInfo.VersionOrBuild);
89+
Console.WriteLine("{0} {1}", ApplicationInfo.ApplicationName, VersionInfo.VersionOrBuild);
9290
Console.WriteLine();
9391
Console.WriteLine("Usage:");
94-
Console.WriteLine(" {0} /input <INPUT> [/output] [<OUTPUT> [...]]", Path.GetFileNameWithoutExtension(version.FileName));
92+
Console.WriteLine(" {0} /input <INPUT> [/output] [<OUTPUT> [...]]", Path.GetFileNameWithoutExtension(ApplicationInfo.ProcessFile));
9593
Console.WriteLine();
9694
Console.WriteLine("Arguments:");
9795
Console.WriteLine(" <INPUT> Specifies the file to read");

Source/Contrib/DataValidator/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@ static void Main(string[] args)
3939

4040
static void ShowHelp()
4141
{
42-
var version = FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.Location);
43-
Console.WriteLine("{0} {1}", version.FileDescription, VersionInfo.VersionOrBuild);
42+
Console.WriteLine("{0} {1}", ApplicationInfo.ApplicationName, VersionInfo.VersionOrBuild);
4443
Console.WriteLine();
4544
Console.WriteLine("Usage:");
46-
Console.WriteLine(" {0} [options] <FILE> [...]", Path.GetFileNameWithoutExtension(version.FileName));
45+
Console.WriteLine(" {0} [options] <FILE> [...]", Path.GetFileNameWithoutExtension(ApplicationInfo.ProcessFile));
4746
Console.WriteLine();
4847
Console.WriteLine("Arguments:");
4948
Console.WriteLine(" <FILE> Data files to validate; may contain wildcards");

Source/Contrib/SimulatorTester/Program.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
using Orts.Simulation;
2222
using ORTS.Common;
2323
using System.IO;
24-
using System.Windows.Forms;
2524
using Orts.Common;
26-
using System.Diagnostics;
2725

2826
namespace SimulatorTester
2927
{
@@ -37,23 +35,22 @@ static void Main(string[] args)
3735

3836
if (files.Count != 1 || options.Contains("help", StringComparer.InvariantCultureIgnoreCase))
3937
{
40-
var version = FileVersionInfo.GetVersionInfo(Application.ExecutablePath);
41-
Console.WriteLine("{0} {1}", version.FileDescription, VersionInfo.VersionOrBuild);
38+
Console.WriteLine("{0} {1}", ApplicationInfo.ApplicationName, VersionInfo.VersionOrBuild);
4239
Console.WriteLine();
4340
Console.WriteLine("Usage:");
44-
Console.WriteLine(" {0} [options] <SAVE_FILE>", Path.GetFileNameWithoutExtension(Application.ExecutablePath));
41+
Console.WriteLine(" {0} [options] <SAVE_FILE>", Path.GetFileNameWithoutExtension(ApplicationInfo.ProcessFile));
4542
Console.WriteLine();
4643
Console.WriteLine("Arguments:");
47-
Console.WriteLine(" <SAVE_FILE> {0} save file to use", Application.ProductName);
44+
Console.WriteLine(" <SAVE_FILE> {0} save file to use", ApplicationInfo.ProductName);
4845
Console.WriteLine();
4946
Console.WriteLine("Options:");
5047
Console.WriteLine(" /quiet Do not show summary of simulation (only exit code is set)");
51-
Console.WriteLine(" /verbose Show version and settings (similar to a {0} log)", Application.ProductName);
48+
Console.WriteLine(" /verbose Show version and settings (similar to a {0} log)", ApplicationInfo.ProductName);
5249
Console.WriteLine(" /fps <FPS> Set the simulation frame-rate [default: 10]");
5350
Console.WriteLine(" /help Show help and usage information");
54-
Console.WriteLine(" ...and any standard {0} option", Application.ProductName);
51+
Console.WriteLine(" ...and any standard {0} option", ApplicationInfo.ProductName);
5552
Console.WriteLine();
56-
Console.WriteLine("The {0} takes a save file and:", version.FileDescription);
53+
Console.WriteLine("The {0} takes a save file and:", ApplicationInfo.ApplicationName);
5754
Console.WriteLine(" - Loads the same activity as contained in the save file");
5855
Console.WriteLine(" - Runs the simulation at the specified FPS for the same duration as the save file");
5956
Console.WriteLine(" - Compares the final position with that contained in the save file");
@@ -65,15 +62,15 @@ static void Main(string[] args)
6562

6663
if (settings.Verbose)
6764
{
68-
Console.WriteLine("This is a log file for {0}. Please include this file in bug reports.", Application.ProductName);
65+
Console.WriteLine("This is a log file for {0}. Please include this file in bug reports.", ApplicationInfo.ProductName);
6966
LogSeparator();
7067

7168
SystemInfo.WriteSystemDetails(Console.Out);
7269
LogSeparator();
7370

7471
Console.WriteLine("Version = {0}", VersionInfo.Version.Length > 0 ? VersionInfo.Version : "<none>");
7572
Console.WriteLine("Build = {0}", VersionInfo.Build);
76-
Console.WriteLine("Executable = {0}", Path.GetFileName(Application.ExecutablePath));
73+
Console.WriteLine("Executable = {0}", Path.GetFileName(ApplicationInfo.ProcessFile));
7774
foreach (var arg in args)
7875
Console.WriteLine("Argument = {0}", arg);
7976
LogSeparator();

Source/Contrib/SimulatorTester/SimulatorTester.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
<RootNamespace>Orts.SimulatorTester</RootNamespace>
77
<AssemblyName>Contrib.SimulatorTester</AssemblyName>
88
<ApplicationIcon>..\..\ORTS.ico</ApplicationIcon>
9-
<UseWindowsForms>true</UseWindowsForms>
10-
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
11-
<OutputPath>..\..\..\Program\</OutputPath>
129
<IsPublishable>False</IsPublishable>
1310
<AssemblyTitle>Open Rails Simulator Tester (Contributed)</AssemblyTitle>
1411
<Description>Open Rails Transport Simulator</Description>

Source/Contrib/TrackViewer/Drawing/DrawTerrain.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,14 @@ void UpdateCamera(DrawArea drawArea)
486486
float camHeight = width / device.Viewport.AspectRatio / 2;
487487
Vector3 cameraPosition = cameraTarget;
488488
cameraPosition.Y = -camHeight;
489+
float nearPlaneDistance = camHeight / 2;
490+
if (nearPlaneDistance <= 0)
491+
{
492+
// distance is too close for CreatePerspectiveFieldOfView
493+
return;
494+
}
489495
basicEffect.View = Matrix.CreateLookAt(cameraPosition, cameraTarget, new Vector3(0, 0, 1));
490-
basicEffect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, device.Viewport.AspectRatio, camHeight / 2, camHeight * 2);
496+
basicEffect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, device.Viewport.AspectRatio, nearPlaneDistance, camHeight * 2);
491497

492498
}
493499
#endregion
Loading

0 commit comments

Comments
 (0)