Skip to content

Commit

Permalink
Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train s…
Browse files Browse the repository at this point in the history
…witching doesn't work with 3D cabs
  • Loading branch information
Csantucci committed Sep 17, 2023
1 parent 782e611 commit 43bf33e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/Orts.Simulation/Simulation/Physics/Train.cs
Expand Up @@ -4362,7 +4362,7 @@ public void CheckFreight()
IsFreight = true;
if ((car.WagonType == TrainCar.WagonTypes.Passenger) || (car.IsDriveable && car.HasPassengerCapacity))
PassengerCarsNumber++;
if (car.IsDriveable && (car as MSTSLocomotive).CabViewList.Count > 0) IsPlayable = true;
if (car.IsDriveable && ((car as MSTSLocomotive).CabViewList.Count > 0 || car.HasFront3DCab || car.HasRear3DCab)) IsPlayable = true;
}
if (TrainType == TRAINTYPE.AI_INCORPORATED && IncorporatingTrainNo > -1) IsPlayable = true;
} // CheckFreight
Expand Down
6 changes: 4 additions & 2 deletions Source/RunActivity/Viewer3D/Viewer.cs
Expand Up @@ -1676,11 +1676,13 @@ public void ChangeCab()
void PlayerLocomotiveChanged(object sender, EventArgs e)
{
PlayerLocomotiveViewer = World.Trains.GetViewer(Simulator.PlayerLocomotive);
CabCamera.Activate(); // If you need anything else here the cameras should check for it.
SetCommandReceivers();
ThreeDimCabCamera.ChangeCab(Simulator.PlayerLocomotive);
HeadOutForwardCamera.ChangeCab(Simulator.PlayerLocomotive);
HeadOutBackCamera.ChangeCab(Simulator.PlayerLocomotive);
if (!Simulator.PlayerLocomotive.HasFront3DCab && !Simulator.PlayerLocomotive.HasRear3DCab)
CabCamera.Activate(); // If you need anything else here the cameras should check for it.
else ThreeDimCabCamera.Activate();
SetCommandReceivers();
}

// change reference to player train when switching train in Timetable mode
Expand Down

0 comments on commit 43bf33e

Please sign in to comment.