Skip to content

Commit 43bf33e

Browse files
committed
Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs
1 parent 782e611 commit 43bf33e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Source/Orts.Simulation/Simulation/Physics/Train.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4362,7 +4362,7 @@ public void CheckFreight()
43624362
IsFreight = true;
43634363
if ((car.WagonType == TrainCar.WagonTypes.Passenger) || (car.IsDriveable && car.HasPassengerCapacity))
43644364
PassengerCarsNumber++;
4365-
if (car.IsDriveable && (car as MSTSLocomotive).CabViewList.Count > 0) IsPlayable = true;
4365+
if (car.IsDriveable && ((car as MSTSLocomotive).CabViewList.Count > 0 || car.HasFront3DCab || car.HasRear3DCab)) IsPlayable = true;
43664366
}
43674367
if (TrainType == TRAINTYPE.AI_INCORPORATED && IncorporatingTrainNo > -1) IsPlayable = true;
43684368
} // CheckFreight

Source/RunActivity/Viewer3D/Viewer.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,11 +1676,13 @@ public void ChangeCab()
16761676
void PlayerLocomotiveChanged(object sender, EventArgs e)
16771677
{
16781678
PlayerLocomotiveViewer = World.Trains.GetViewer(Simulator.PlayerLocomotive);
1679-
CabCamera.Activate(); // If you need anything else here the cameras should check for it.
1680-
SetCommandReceivers();
16811679
ThreeDimCabCamera.ChangeCab(Simulator.PlayerLocomotive);
16821680
HeadOutForwardCamera.ChangeCab(Simulator.PlayerLocomotive);
16831681
HeadOutBackCamera.ChangeCab(Simulator.PlayerLocomotive);
1682+
if (!Simulator.PlayerLocomotive.HasFront3DCab && !Simulator.PlayerLocomotive.HasRear3DCab)
1683+
CabCamera.Activate(); // If you need anything else here the cameras should check for it.
1684+
else ThreeDimCabCamera.Activate();
1685+
SetCommandReceivers();
16841686
}
16851687

16861688
// change reference to player train when switching train in Timetable mode

0 commit comments

Comments
 (0)