From 13e1c82010b57a72d6a1e8739cf35c1986f214a7 Mon Sep 17 00:00:00 2001 From: Paul Sladen Date: Sun, 5 Apr 2009 20:38:21 +0300 Subject: [PATCH] * Load timetables relative to route directory, not trainpath + disable spurious Train folder warning message, as existance is not required later --- debian/changelog | 2 ++ openBVE/OpenBve/Loading.cs | 8 +++----- openBVE/OpenBve/Parsers/CsvRwRouteParser.cs | 16 ++++++++++++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 050a882..cd7749c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,8 @@ openbve (1.0.2.0-0buntu1) unreleased; urgency=low * Load first-use Keyboard mapping from GetDataFolder("Controls") not ~/ * Default first-use game data from /usr/share/games/bve/{Railway/Route,Train} * Update 'openbve-data' Depends: >= 1.0.2.0+dfsg + * Load timetables relative to route directory, not trainpath + + disable spurious Train folder warning message, as existance is not required later -- Paul Sladen Sun, 05 Apr 2009 12:33:10 +0000 diff --git a/openBVE/OpenBve/Loading.cs b/openBVE/OpenBve/Loading.cs index b3fef25..12c24f4 100644 --- a/openBVE/OpenBve/Loading.cs +++ b/openBVE/OpenBve/Loading.cs @@ -50,10 +50,8 @@ namespace OpenBve { while (true) { string Subfolder = Interface.GetCombinedFolderName(Folder, "Railway"); if (System.IO.Directory.Exists(Subfolder)) { - string a = Interface.GetCombinedFolderName(Folder, "Train"); - if (System.IO.Directory.Exists(a)) { - return Subfolder; - } + /* Checking for the "Train" folder is unnecessary, as it is not used later */ + return Subfolder; } System.IO.DirectoryInfo Info = System.IO.Directory.GetParent(Folder); if (Info == null) return null; @@ -77,7 +75,7 @@ namespace OpenBve { private static void LoadEverythingThreaded() { string RailwayFolder = GetRailwayFolder(CurrentRouteFile); if (RailwayFolder == null) { - Interface.AddMessage(Interface.MessageType.Critical, false, "The Railway and Train folders could not be found in any of the route file's parent directories. Please check your folder structure."); + Interface.AddMessage(Interface.MessageType.Critical, false, "The Railway folder could not be found in any of the route file's parent directories. Please check your folder structure."); return; } string ObjectFolder = Interface.GetCombinedFolderName(RailwayFolder, "Object"); diff --git a/openBVE/OpenBve/Parsers/CsvRwRouteParser.cs b/openBVE/OpenBve/Parsers/CsvRwRouteParser.cs index 7f3186f..16c141a 100644 --- a/openBVE/OpenBve/Parsers/CsvRwRouteParser.cs +++ b/openBVE/OpenBve/Parsers/CsvRwRouteParser.cs @@ -1482,7 +1482,13 @@ namespace OpenBve { Data.TimetableDaytime[i] = -1; } } - string f = Interface.GetCombinedFileName(TrainPath, Arguments[0]); + /* Hack: try something in the Route's hierarchy first; not sure + ** what the clean way to do this would be... Also this is the only + ** (mis-)use? of Trainpath whilst parsing a Route */ + string f = Interface.GetCombinedFileName(ObjectPath, Arguments[0]); + if(!System.IO.File.Exists(f)) { + f = Interface.GetCombinedFileName(TrainPath, Arguments[0]); + } if (!System.IO.File.Exists(f)) { Interface.AddMessage(Interface.MessageType.Error, true, "Texture file " + f + " not found in " + Command + " at line " + Expressions[j].Line.ToString(Culture) + ", column " + Expressions[j].Column.ToString(Culture) + " in file " + FileName); } else { @@ -1507,7 +1513,13 @@ namespace OpenBve { Data.TimetableNighttime[i] = -1; } } - string f = Interface.GetCombinedFileName(TrainPath, Arguments[0]); + /* Hack: try something in the Route's hierarchy first; not sure + ** what the clean way to do this would be... Also this is the only + ** (mis-)use? of Trainpath whilst parsing a Route */ + string f = Interface.GetCombinedFileName(ObjectPath, Arguments[0]); + if(!System.IO.File.Exists(f)) { + f = Interface.GetCombinedFileName(TrainPath, Arguments[0]); + } if (!System.IO.File.Exists(f)) { Interface.AddMessage(Interface.MessageType.Error, true, "Texture file " + f + " not found in " + Command + " at line " + Expressions[j].Line.ToString(Culture) + ", column " + Expressions[j].Column.ToString(Culture) + " in file " + FileName); } else { -- 1.6.0.4