Skip to content

Commit 6ccf85e

Browse files
authored
Merge pull request #473 from peternewell/control-trailer#1
Further enhancements to Control Car
2 parents 962630f + d08e0b9 commit 6ccf85e

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
@@ -4578,18 +4578,51 @@ public virtual float GetDataOf(CabViewControl cvc)
45784578

45794579
case CABViewControlTypes.ORTS_DIESEL_TEMPERATURE:
45804580
{
4581-
var mstsDieselLocomotive = this as MSTSDieselLocomotive;
4582-
if (mstsDieselLocomotive.DieselEngines[0] != null)
4583-
data = mstsDieselLocomotive.DieselEngines[0].DieselTemperatureDeg;
4581+
4582+
if (EngineType == EngineTypes.Control)
4583+
{
4584+
FindControlActiveLocomotive();
4585+
4586+
if (ControlActiveLocomotive != null)
4587+
{
4588+
var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive;
4589+
if (activeloco.DieselEngines[0] != null)
4590+
data = activeloco.DieselEngines[0].DieselTemperatureDeg;
4591+
}
4592+
4593+
}
4594+
else
4595+
{
4596+
var mstsDieselLocomotive = this as MSTSDieselLocomotive;
4597+
if (mstsDieselLocomotive.DieselEngines[0] != null)
4598+
data = mstsDieselLocomotive.DieselEngines[0].DieselTemperatureDeg;
4599+
}
45844600
break;
45854601
}
4602+
45864603
case CABViewControlTypes.ORTS_OIL_PRESSURE:
45874604
{
4588-
var mstsDieselLocomotive = this as MSTSDieselLocomotive;
4589-
if (mstsDieselLocomotive.DieselEngines[0] != null)
4590-
data = ConvertFromPSI(cvc, mstsDieselLocomotive.DieselEngines[0].DieselOilPressurePSI);
4605+
if (EngineType == EngineTypes.Control)
4606+
{
4607+
FindControlActiveLocomotive();
4608+
4609+
if (ControlActiveLocomotive != null)
4610+
{
4611+
var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive;
4612+
if (activeloco.DieselEngines[0] != null)
4613+
data = activeloco.DieselEngines[0].DieselOilPressurePSI;
4614+
}
4615+
4616+
}
4617+
else
4618+
{
4619+
var mstsDieselLocomotive = this as MSTSDieselLocomotive;
4620+
if (mstsDieselLocomotive.DieselEngines[0] != null)
4621+
data = mstsDieselLocomotive.DieselEngines[0].DieselOilPressurePSI;
4622+
}
45914623
break;
45924624
}
4625+
45934626
case CABViewControlTypes.THROTTLE:
45944627
case CABViewControlTypes.THROTTLE_DISPLAY:
45954628
case CABViewControlTypes.CPH_DISPLAY:
@@ -4729,10 +4762,31 @@ public virtual float GetDataOf(CabViewControl cvc)
47294762
}
47304763
case CABViewControlTypes.WHEELSLIP:
47314764
{
4732-
if (AdvancedAdhesionModel && Train.TrainType != Train.TRAINTYPE.AI_PLAYERHOSTING)
4733-
data = LocomotiveAxle.IsWheelSlipWarning ? 1 : 0;
4765+
if (EngineType == EngineTypes.Control)
4766+
{
4767+
FindControlActiveLocomotive();
4768+
4769+
if (ControlActiveLocomotive != null)
4770+
{
4771+
var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive;
4772+
if (activeloco.DieselEngines[0] != null)
4773+
{
4774+
if (activeloco.AdvancedAdhesionModel && Train.TrainType != Train.TRAINTYPE.AI_PLAYERHOSTING)
4775+
data = activeloco.LocomotiveAxle.IsWheelSlipWarning ? 1 : 0;
4776+
else
4777+
data = activeloco.WheelSlip ? 1 : 0;
4778+
4779+
}
4780+
}
4781+
4782+
}
47344783
else
4735-
data = WheelSlip ? 1 : 0;
4784+
{
4785+
if (AdvancedAdhesionModel && Train.TrainType != Train.TRAINTYPE.AI_PLAYERHOSTING)
4786+
data = LocomotiveAxle.IsWheelSlipWarning ? 1 : 0;
4787+
else
4788+
data = WheelSlip ? 1 : 0;
4789+
}
47364790
break;
47374791
}
47384792

0 commit comments

Comments
 (0)