Skip to content

Commit

Permalink
Fixed static consists not showing up on map
Browse files Browse the repository at this point in the history
  • Loading branch information
Looky1173 committed Aug 27, 2023
1 parent f67581c commit 9d8513a
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions Source/RunActivity/Viewer3D/Debugging/DebugViewerBetaForm.cs
Expand Up @@ -12,6 +12,7 @@
using Orts.Simulation.Physics;
using Orts.Simulation.RollingStocks;
using Orts.Simulation.Signalling;
using Orts.Simulation.Timetables;
using Orts.Viewer3D.Popups;
using ORTS.Common;
using Color = System.Drawing.Color;
Expand Down Expand Up @@ -498,18 +499,12 @@ private void DrawTrains(Graphics g, PointF scaledA, PointF scaledB)
if (simulator.TimetableMode)
{
// Add the player's train...
if (simulator.PlayerLocomotive.Train is Simulation.AIs.AITrain)
selectedTrainList.Add(simulator.PlayerLocomotive.Train as Simulation.AIs.AITrain);
if (simulator.PlayerLocomotive.Train is AITrain)
selectedTrainList.Add(simulator.PlayerLocomotive.Train as AITrain);

// ...then all the AI trains...
// ...then all the AI trains, including static consists.
foreach (AITrain train in simulator.AI.AITrains)
selectedTrainList.Add(train);

// ...and finally the static consists.
foreach (Train staticConsist in simulator.Trains.Where(c => c.TrainType == Train.TRAINTYPE.STATIC))
{
selectedTrainList.Add(staticConsist);
}
}
else
{
Expand Down Expand Up @@ -675,7 +670,7 @@ private void SetTrainColor(Train t, TrainCar locoCar, TrainCar car)
trainPen.Color = car is MSTSLocomotive ? Color.FromArgb(153, 128, 0) : Color.FromArgb(0, 153, 0);
}

if (t.TrainType == Train.TRAINTYPE.STATIC)
if (t.TrainType == Train.TRAINTYPE.STATIC || (t.TrainType == Train.TRAINTYPE.AI && t.GetAIMovementState() == AITrain.AI_MOVEMENT_STATE.AI_STATIC))
{
trainPen.Color = Color.FromArgb(83, 237, 214);
}
Expand All @@ -692,7 +687,7 @@ private void DrawTrainLabels(Graphics g, Train t, string trainName, TrainCar fir
scaledTrain.Y = -25 + mapCanvas.Height - (((worldPos.TileZ * 2048) - subY + worldPos.Location.Z) * yScale);
if (showActiveTrainsRadio.Checked)
{
if (t is Simulation.AIs.AITrain && MapDataProvider.IsActiveTrain(t as Simulation.AIs.AITrain))
if (t is AITrain && MapDataProvider.IsActiveTrain(t as AITrain))
ShowTrainNameAndState(g, scaledTrain, t, trainName);
}
else
Expand All @@ -705,7 +700,7 @@ private void ShowTrainNameAndState(Graphics g, PointF scaledItem, Train t, strin
{
if (simulator.TimetableMode)
{
if (t is Simulation.Timetables.TTTrain tTTrain)
if (t is TTTrain tTTrain)
{
// Remove name of timetable, e.g.: ":SCE"
var lastPos = trainName.LastIndexOf(":");
Expand Down

0 comments on commit 9d8513a

Please sign in to comment.