Skip to content

Commit 9d8513a

Browse files
committed
Fixed static consists not showing up on map
1 parent f67581c commit 9d8513a

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

Source/RunActivity/Viewer3D/Debugging/DebugViewerBetaForm.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Orts.Simulation.Physics;
1313
using Orts.Simulation.RollingStocks;
1414
using Orts.Simulation.Signalling;
15+
using Orts.Simulation.Timetables;
1516
using Orts.Viewer3D.Popups;
1617
using ORTS.Common;
1718
using Color = System.Drawing.Color;
@@ -498,18 +499,12 @@ private void DrawTrains(Graphics g, PointF scaledA, PointF scaledB)
498499
if (simulator.TimetableMode)
499500
{
500501
// Add the player's train...
501-
if (simulator.PlayerLocomotive.Train is Simulation.AIs.AITrain)
502-
selectedTrainList.Add(simulator.PlayerLocomotive.Train as Simulation.AIs.AITrain);
502+
if (simulator.PlayerLocomotive.Train is AITrain)
503+
selectedTrainList.Add(simulator.PlayerLocomotive.Train as AITrain);
503504

504-
// ...then all the AI trains...
505+
// ...then all the AI trains, including static consists.
505506
foreach (AITrain train in simulator.AI.AITrains)
506507
selectedTrainList.Add(train);
507-
508-
// ...and finally the static consists.
509-
foreach (Train staticConsist in simulator.Trains.Where(c => c.TrainType == Train.TRAINTYPE.STATIC))
510-
{
511-
selectedTrainList.Add(staticConsist);
512-
}
513508
}
514509
else
515510
{
@@ -675,7 +670,7 @@ private void SetTrainColor(Train t, TrainCar locoCar, TrainCar car)
675670
trainPen.Color = car is MSTSLocomotive ? Color.FromArgb(153, 128, 0) : Color.FromArgb(0, 153, 0);
676671
}
677672

678-
if (t.TrainType == Train.TRAINTYPE.STATIC)
673+
if (t.TrainType == Train.TRAINTYPE.STATIC || (t.TrainType == Train.TRAINTYPE.AI && t.GetAIMovementState() == AITrain.AI_MOVEMENT_STATE.AI_STATIC))
679674
{
680675
trainPen.Color = Color.FromArgb(83, 237, 214);
681676
}
@@ -692,7 +687,7 @@ private void DrawTrainLabels(Graphics g, Train t, string trainName, TrainCar fir
692687
scaledTrain.Y = -25 + mapCanvas.Height - (((worldPos.TileZ * 2048) - subY + worldPos.Location.Z) * yScale);
693688
if (showActiveTrainsRadio.Checked)
694689
{
695-
if (t is Simulation.AIs.AITrain && MapDataProvider.IsActiveTrain(t as Simulation.AIs.AITrain))
690+
if (t is AITrain && MapDataProvider.IsActiveTrain(t as AITrain))
696691
ShowTrainNameAndState(g, scaledTrain, t, trainName);
697692
}
698693
else
@@ -705,7 +700,7 @@ private void ShowTrainNameAndState(Graphics g, PointF scaledItem, Train t, strin
705700
{
706701
if (simulator.TimetableMode)
707702
{
708-
if (t is Simulation.Timetables.TTTrain tTTrain)
703+
if (t is TTTrain tTTrain)
709704
{
710705
// Remove name of timetable, e.g.: ":SCE"
711706
var lastPos = trainName.LastIndexOf(":");

0 commit comments

Comments
 (0)