Skip to content

Commit d08e0b9

Browse files
committed
Adjust some gauges so that they will appear on the control car.
1 parent 58fb8cb commit d08e0b9

File tree

1 file changed

+63
-9
lines changed

1 file changed

+63
-9
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 63 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4614,18 +4614,51 @@ public virtual float GetDataOf(CabViewControl cvc)
46144614

46154615
case CABViewControlTypes.ORTS_DIESEL_TEMPERATURE:
46164616
{
4617-
var mstsDieselLocomotive = this as MSTSDieselLocomotive;
4618-
if (mstsDieselLocomotive.DieselEngines[0] != null)
4619-
data = mstsDieselLocomotive.DieselEngines[0].DieselTemperatureDeg;
4617+
4618+
if (EngineType == EngineTypes.Control)
4619+
{
4620+
FindControlActiveLocomotive();
4621+
4622+
if (ControlActiveLocomotive != null)
4623+
{
4624+
var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive;
4625+
if (activeloco.DieselEngines[0] != null)
4626+
data = activeloco.DieselEngines[0].DieselTemperatureDeg;
4627+
}
4628+
4629+
}
4630+
else
4631+
{
4632+
var mstsDieselLocomotive = this as MSTSDieselLocomotive;
4633+
if (mstsDieselLocomotive.DieselEngines[0] != null)
4634+
data = mstsDieselLocomotive.DieselEngines[0].DieselTemperatureDeg;
4635+
}
46204636
break;
46214637
}
4638+
46224639
case CABViewControlTypes.ORTS_OIL_PRESSURE:
46234640
{
4624-
var mstsDieselLocomotive = this as MSTSDieselLocomotive;
4625-
if (mstsDieselLocomotive.DieselEngines[0] != null)
4626-
data = ConvertFromPSI(cvc, mstsDieselLocomotive.DieselEngines[0].DieselOilPressurePSI);
4641+
if (EngineType == EngineTypes.Control)
4642+
{
4643+
FindControlActiveLocomotive();
4644+
4645+
if (ControlActiveLocomotive != null)
4646+
{
4647+
var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive;
4648+
if (activeloco.DieselEngines[0] != null)
4649+
data = activeloco.DieselEngines[0].DieselOilPressurePSI;
4650+
}
4651+
4652+
}
4653+
else
4654+
{
4655+
var mstsDieselLocomotive = this as MSTSDieselLocomotive;
4656+
if (mstsDieselLocomotive.DieselEngines[0] != null)
4657+
data = mstsDieselLocomotive.DieselEngines[0].DieselOilPressurePSI;
4658+
}
46274659
break;
46284660
}
4661+
46294662
case CABViewControlTypes.THROTTLE:
46304663
case CABViewControlTypes.THROTTLE_DISPLAY:
46314664
case CABViewControlTypes.CPH_DISPLAY:
@@ -4765,10 +4798,31 @@ public virtual float GetDataOf(CabViewControl cvc)
47654798
}
47664799
case CABViewControlTypes.WHEELSLIP:
47674800
{
4768-
if (AdvancedAdhesionModel && Train.TrainType != Train.TRAINTYPE.AI_PLAYERHOSTING)
4769-
data = LocomotiveAxle.IsWheelSlipWarning ? 1 : 0;
4801+
if (EngineType == EngineTypes.Control)
4802+
{
4803+
FindControlActiveLocomotive();
4804+
4805+
if (ControlActiveLocomotive != null)
4806+
{
4807+
var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive;
4808+
if (activeloco.DieselEngines[0] != null)
4809+
{
4810+
if (activeloco.AdvancedAdhesionModel && Train.TrainType != Train.TRAINTYPE.AI_PLAYERHOSTING)
4811+
data = activeloco.LocomotiveAxle.IsWheelSlipWarning ? 1 : 0;
4812+
else
4813+
data = activeloco.WheelSlip ? 1 : 0;
4814+
4815+
}
4816+
}
4817+
4818+
}
47704819
else
4771-
data = WheelSlip ? 1 : 0;
4820+
{
4821+
if (AdvancedAdhesionModel && Train.TrainType != Train.TRAINTYPE.AI_PLAYERHOSTING)
4822+
data = LocomotiveAxle.IsWheelSlipWarning ? 1 : 0;
4823+
else
4824+
data = WheelSlip ? 1 : 0;
4825+
}
47724826
break;
47734827
}
47744828

0 commit comments

Comments
 (0)