Skip to content

Commit 386b363

Browse files
committed
Automatic merge of T1.5.1-368-g38888b34f and 9 pull requests
- Pull request #570 at de7a14f: Experimental glTF 2.0 support with PBR lighting - Pull request #732 at 79e9c38: Improvements for air brakes - Pull request #751 at 00981a2: Web interface to control cab controls with external hardware - Pull request #799 at eb92d81: Consolidated wind simulation - Pull request #803 at 7157e08: Various adjustments to steam adhesion - Pull request #813 at a23bd5c: Refactored garbage generators - Pull request #814 at b102c1c: Bug fix for https://bugs.launchpad.net/or/+bug/2013969 Crash after uncoupling player loco of a train with EOT - Pull request #815 at a5cc165: chore: Add GitHub automatic release notes configuration - Pull request #816 at eae646d: Bug fix for https://bugs.launchpad.net/or/+bug/2014992 EOT can't be dismounted after train reversal
11 parents 899b53d + 38888b3 + de7a14f + 79e9c38 + 00981a2 + eb92d81 + 7157e08 + a23bd5c + b102c1c + a5cc165 + eae646d commit 386b363

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Source/Orts.Simulation/Common/Commands.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -2265,9 +2265,9 @@ public override void Redo()
22652265
{
22662266
if (Receiver?.Train != null)
22672267
{
2268+
var wagonFilePath = PickedEOTType.ToLower();
22682269
if (ToState)
22692270
{
2270-
var wagonFilePath = PickedEOTType.ToLower();
22712271
try
22722272
{
22732273
EOT eot = (EOT)RollingStock.Load(Receiver.Train.Simulator, Receiver.Train, wagonFilePath);
@@ -2284,8 +2284,14 @@ public override void Redo()
22842284
}
22852285
else
22862286
{
2287-
Receiver.Train.RecalculateRearTDBTraveller();
22882287
var car = Receiver.Train.Cars[Receiver.Train.Cars.Count - 1];
2288+
if (wagonFilePath != car.WagFilePath.ToLower())
2289+
{
2290+
car = Receiver.Train.Cars[0];
2291+
if (Receiver.Train.LeadLocomotive != null) Receiver.Train.LeadLocomotiveIndex--;
2292+
}
2293+
else
2294+
Receiver.Train.RecalculateRearTDBTraveller();
22892295
car.Train = null;
22902296
car.IsPartOfActiveTrain = false; // to stop sounds
22912297
Receiver.Train.Cars.Remove(car);

Source/RunActivity/Viewer3D/Popups/EOTListWindow.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ void EOTListLabel_Click(Control arg1, Point arg2)
103103
Viewer.Simulator.Confirmer.Information(Viewer.Catalog.GetString("Can't attach EOT if player train not stopped"));
104104
return;
105105
}
106-
if (PickedEOTTypeFromList.ToLower() != Viewer.PlayerLocomotive.Train.Cars[Viewer.PlayerLocomotive.Train.Cars.Count - 1].WagFilePath.ToLower())
106+
if (PickedEOTTypeFromList.ToLower() != Viewer.PlayerLocomotive.Train.Cars[Viewer.PlayerLocomotive.Train.Cars.Count - 1].WagFilePath.ToLower() &&
107+
PickedEOTTypeFromList.ToLower() != Viewer.PlayerLocomotive.Train.Cars[0].WagFilePath.ToLower())
107108
{
108109
if (Viewer.PlayerLocomotive.Train?.EOT != null)
109110
{
@@ -113,7 +114,8 @@ void EOTListLabel_Click(Control arg1, Point arg2)
113114
//Ask to mount EOT
114115
new EOTMountCommand(Viewer.Log, true, PickedEOTTypeFromList);
115116
}
116-
else if (PickedEOTTypeFromList.ToLower() == Viewer.PlayerLocomotive.Train.Cars[Viewer.PlayerLocomotive.Train.Cars.Count - 1].WagFilePath.ToLower())
117+
else if (PickedEOTTypeFromList.ToLower() == Viewer.PlayerLocomotive.Train.Cars[Viewer.PlayerLocomotive.Train.Cars.Count - 1].WagFilePath.ToLower() ||
118+
PickedEOTTypeFromList.ToLower() == Viewer.PlayerLocomotive.Train.Cars[0].WagFilePath.ToLower())
117119
{
118120
new EOTMountCommand(Viewer.Log, false, PickedEOTTypeFromList);
119121
}

0 commit comments

Comments
 (0)