Skip to content

Commit 0cd8cb8

Browse files
authored
Merge pull request #1063 from SteelFill/error_messages
Better Missing Track Section Error Message
2 parents f88b8b9 + 6c23191 commit 0cd8cb8

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Source/Orts.Simulation/Simulation/Traveller.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public Traveller(TrackSectionsFile tSectionDat, TrackNode[] trackNodes, TrackNod
261261
throw new InvalidDataException(String.Format("Track node {0} could not be found in the track database.", startTrackNode.UiD));
262262
else
263263
{
264-
throw new MissingTrackNodeException();
264+
throw new MissingTrackNodeException(tvs.ShapeIndex);
265265
}
266266

267267
}
@@ -295,7 +295,7 @@ public Traveller(TrackSectionsFile tSectionDat, TrackNode[] trackNodes, TrackNod
295295
throw new InvalidDataException(String.Format("Track node {0} could not be found in the track database.", startTrackNode.UiD));
296296
else
297297
{
298-
throw new MissingTrackNodeException();
298+
throw new MissingTrackNodeException(tvs.ShapeIndex);
299299
}
300300

301301
}
@@ -1358,9 +1358,12 @@ void InitFromCandidate(TrackNodeCandidate candidate)
13581358

13591359
public sealed class MissingTrackNodeException : Exception
13601360
{
1361-
public MissingTrackNodeException()
1361+
public readonly uint Index;
1362+
1363+
public MissingTrackNodeException(uint index)
13621364
: base("")
13631365
{
1366+
Index = index;
13641367
}
13651368
}
13661369
}

Source/RunActivity/Viewer3D/Processes/GameStateRunActivity.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// COPYRIGHT 2021 by the Open Rails project.
1+
// COPYRIGHT 2021 by the Open Rails project.
22
//
33
// This file is part of Open Rails.
44
//
@@ -281,8 +281,10 @@ internal override void Load()
281281
String.Join("\n", data.Select(d => "\u2022 " + d).ToArray())),
282282
Application.ProductName + " " + VersionInfo.VersionOrBuild, MessageBoxButtons.OK, MessageBoxIcon.Error);
283283
else if (error is Traveller.MissingTrackNodeException)
284-
MessageBox.Show(String.Format("Open Rails detected a track section which is not present in tsection.dat and cannot continue.\n\n" +
285-
"Most likely you don't have the XTracks or Ytracks version needed for this route."));
284+
MessageBox.Show(String.Format("Open Rails detected a track shape index {0} which is not present in tsection.dat and cannot continue.\n\n" +
285+
"The version of standard tsection.dat may be out of date, or this route requires a custom tsection.dat.\n" +
286+
"Please check the route installation instructions to verify the required tsection.dat.",
287+
((Traveller.MissingTrackNodeException)error).Index));
286288
else if (error is FileNotFoundException)
287289
{
288290
MessageBox.Show(String.Format(

0 commit comments

Comments
 (0)