Skip to content

Commit 703db7b

Browse files
committed
Automatic merge of T1.5.1-1090-g9915d87ce6 and 20 pull requests
- Pull request #891 at 9a1d6b2: Auto save - Pull request #954 at 3efaf6d: Multiple Track Profiles & Superelevation Improvements - Pull request #959 at 2452cb0: Fix TrackViewer crash on big zoom value - Pull request #972 at e90a2aa: On Map window color changed switch or signal is not changed - Pull request #976 at 877cc94: Increased center of gravity range - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #882 at 8f695a4: Blueprint/train car operations UI window - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #922 at a3bc9e7: Autopilot for timetable mode - Pull request #953 at a519452: Fix Lights Crash on Corrupt Shapes - Pull request #962 at 46d0472: Fix pantographs on unpowered cars - Pull request #970 at 6fa5eed: feat: Remove unnecessary Windows.Forms usage - Pull request #973 at c35be87: fix: Using singular target framework to allow for different platforms across different projects - Pull request #974 at 5faea6f: Bug fix for https://bugs.launchpad.net/or/+bug/2076034 Doors remain open in AI trains - Pull request #978 at 91f3ee8: fix: adds MilepostUnitsMiles to Manual - Pull request #900 at c27f32d: DMI updates - Pull request #903 at 4a4b032: Downloading route content (Github, zip) - Pull request #799 at dfc715e: Consolidated wind simulation - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #952 at 8347095: Investigation - Pulsing graphics
22 parents 7b4ec67 + 9915d87 + 9a1d6b2 + 3efaf6d + 2452cb0 + e90a2aa + 877cc94 + d00beb9 + 8f695a4 + 1f5ba4c + a3bc9e7 + a519452 + 46d0472 + 6fa5eed + c35be87 + 5faea6f + 91f3ee8 + c27f32d + 4a4b032 + dfc715e + f92de76 + 8347095 commit 703db7b

File tree

2 files changed

+9
-25
lines changed

2 files changed

+9
-25
lines changed

Source/Orts.Formats.Msts/ShapeDescriptorFile.cs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
// along with Open Rails. If not, see <http://www.gnu.org/licenses/>.
1717

1818
using System;
19-
using System.Collections.Generic;
20-
2119
using Orts.Parsers.Msts;
2220

2321
namespace Orts.Formats.Msts
@@ -31,26 +29,16 @@ public class ShapeDescriptorFile
3129
shape = new SDShape();
3230
}
3331

34-
public static Dictionary<string, SDShape> Cache = new Dictionary<string, SDShape>();
35-
3632
public ShapeDescriptorFile(string filename)
3733
{
38-
var shapeDescriptorPath = filename.ToLowerInvariant();
39-
if (Cache.ContainsKey(shapeDescriptorPath))
34+
using (STFReader stf = new STFReader(filename, false))
4035
{
41-
shape = Cache[shapeDescriptorPath];
42-
}
43-
else
44-
{
45-
using (STFReader stf = new STFReader(filename, false))
46-
{
47-
stf.ParseFile(new STFReader.TokenProcessor[] {
48-
new STFReader.TokenProcessor("shape", ()=>{ shape = new SDShape(stf); }),
49-
});
50-
//TODO This should be changed to STFException.TraceError() with defaults values created
51-
if (shape == null) throw new STFException(stf, "Missing shape statement");
52-
}
53-
Cache.Add(shapeDescriptorPath, shape);
36+
stf.ParseFile(new STFReader.TokenProcessor[] {
37+
new STFReader.TokenProcessor("shape", ()=>{ shape = new SDShape(stf); }),
38+
});
39+
//TODO This should be changed to STFException.TraceError() with defaults values created
40+
if (shape == null)
41+
throw new STFException(stf, "Missing shape statement");
5442
}
5543
}
5644

Source/RunActivity/Viewer3D/Scenery.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,9 @@ public WorldFile(Viewer viewer, int tileX, int tileZ, bool visible)
349349
}
350350
}
351351

352-
var shapeDescriptorPath = shapeFilePath + "d";
353-
if (shapeFilePath != null)
354-
{
355-
var shape = new ShapeDescriptorFile(shapeDescriptorPath);
356-
if (shape != null)
352+
if (shapeFilePath != null && File.Exists(shapeFilePath + "d"))
357353
{
354+
var shape = new ShapeDescriptorFile(shapeFilePath + "d");
358355
if (shape.shape.ESD_Bounding_Box != null)
359356
{
360357
var min = shape.shape.ESD_Bounding_Box.Min;
@@ -367,7 +364,6 @@ public WorldFile(Viewer viewer, int tileX, int tileZ, bool visible)
367364
BoundingBoxes.Add(new BoundingBox(transform, new Vector3((max.X - min.X) / 2, (max.Y - min.Y) / 2, (max.Z - min.Z) / 2), worldMatrix.XNAMatrix.Translation.Y));
368365
}
369366
}
370-
}
371367

372368
try
373369
{

0 commit comments

Comments
 (0)