Skip to content

Commit 437f04e

Browse files
committed
Automatic merge of T1.6-rc7-43-ge3d1d75f9 and 15 pull requests
- Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 2e06f85: Automatic speed control - Pull request #1104 at 87cdd9f: Handle simple adhesion within the axle module - Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached - Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing - Pull request #1121 at 91d2d26: Manually Override Articulation - Pull request #1130 at 8ae6bb7: Fix F9 points to an incorrect car ID. - Pull request #1143 at 84f72b8: Status in Work Orders popup set too fast - Pull request #1151 at 5e59187: fix: Do not allow non-ACE/DDS textures in content - Pull request #1152 at 66dfd09: fix: Clean up multiple issues with data logger - Pull request #1153 at b6baa4c: Fix TrItems in track viewer (events were over-writing mileposts) - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1081 at 689494b: Brake cuts power unification - Pull request #1124 at fab5457: Built-in PBL2 brake controller - Pull request #1128 at 278d8ff: Particle Emitter Overhaul
17 parents 9246f8c + e3d1d75 + e10390b + 2e06f85 + 87cdd9f + 270f22f + ba3c47f + 91d2d26 + 8ae6bb7 + 84f72b8 + 5e59187 + 66dfd09 + b6baa4c + 5845a1a + 689494b + fab5457 + 278d8ff commit 437f04e

File tree

1 file changed

+15
-29
lines changed

1 file changed

+15
-29
lines changed

Source/Contrib/TrackViewer/Drawing/DrawTrackDB.cs

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -107,37 +107,14 @@ public RouteData(string routePath, MessageDelegate messageDelegate)
107107
//sigcfgFile = null; // default initialization
108108
}
109109

110-
// read the activity location events and store them in the TrackDB.TrItemTable
110+
// read the activity location events and add them to the TrackDB.TrItemTable
111111

112112
ActivityNames.Clear();
113113
var directory = System.IO.Path.Combine(routePath, "ACTIVITIES");
114114
if (System.IO.Directory.Exists(directory))
115115
{
116-
// counting
117-
int cnt = 0;
118-
119-
foreach (var file in Directory.GetFiles(directory, "*.act"))
120-
{
121-
try
122-
{
123-
var activityFile = new ActivityFile(file);
124-
Events events = activityFile.Tr_Activity.Tr_Activity_File.Events;
125-
if (events != null)
126-
{
127-
for (int i = 0; i < events.EventList.Count; i++)
128-
{
129-
if (events.EventList[i].GetType() == typeof(EventCategoryLocation))
130-
{
131-
cnt++;
132-
}
133-
}
134-
}
135-
}
136-
catch { }
137-
}
138-
139-
// adding
140-
uint index = 0;
116+
int index = TrackDB.TrItemTable.Length;
117+
List<TrItem> eventItems = new List<TrItem>();
141118
foreach (var file in Directory.GetFiles(directory, "*.act"))
142119
{
143120
try
@@ -157,8 +134,8 @@ public RouteData(string routePath, MessageDelegate messageDelegate)
157134
eventCategoryLocation.Outcomes.DisplayMessage,
158135
eventCategoryLocation.TileX, eventCategoryLocation.TileZ,
159136
eventCategoryLocation.X, 0, eventCategoryLocation.Z,
160-
index);
161-
TrackDB.TrItemTable[index] = eventItem;
137+
(uint)index);
138+
eventItems.Add(eventItem);
162139
index++;
163140
found = true;
164141
}
@@ -168,9 +145,18 @@ public RouteData(string routePath, MessageDelegate messageDelegate)
168145
ActivityNames.Add(activityFile.Tr_Activity.Tr_Activity_Header.Name);
169146
}
170147
}
171-
catch { }
148+
catch { /* just ignore activity files with problems */ }
172149
}
173150

151+
// extend the track items array and append the event items
152+
if (eventItems.Count > 0)
153+
{
154+
int oldSize = TrackDB.TrItemTable.Length;
155+
Array.Resize<TrItem>(ref TrackDB.TrItemTable, index);
156+
int newSize = TrackDB.TrItemTable.Length;
157+
int eventSize = eventItems.Count;
158+
for (int toIdx = oldSize, fromIdx = 0; toIdx < newSize && fromIdx < eventSize; toIdx++, fromIdx++) { TrackDB.TrItemTable[toIdx] = eventItems[fromIdx]; }
159+
}
174160
}
175161
}
176162

0 commit comments

Comments
 (0)