Skip to content

Commit

Permalink
Add warning message for type C gearboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
peternewell committed Jan 20, 2023
1 parent 3d5d238 commit c9657de
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 18 deletions.
Expand Up @@ -55,6 +55,7 @@ public class MSTSControlTrailerCar : MSTSLocomotive
bool ControlGearDown = false;
int ControlGearIndex;
int ControlGearIndication;
string ControlGearBoxType;


public MSTSControlTrailerCar(Simulator simulator, string wagFile)
Expand Down Expand Up @@ -216,11 +217,15 @@ public override void Update(float elapsedClockSeconds)
}
}

// Read values for the HuD, will be based upon the last motorcar
// Read values for the HuD and other requirements, will be based upon the last motorcar
if (locog != null)
{
ControlGearIndex = locog.DieselEngines[0].GearBox.CurrentGearIndex;
ControlGearIndication = locog.DieselEngines[0].GearBox.GearIndication;
if (locog.DieselEngines[0].GearBox.GearBoxType == TypesGearBox.C)
{
ControlGearBoxType = "C";
}
}
}

Expand Down Expand Up @@ -270,25 +275,53 @@ protected override void UpdateSoundVariables(float elapsedClockSeconds)
public override void ChangeGearUp()
{

GearBoxController.CurrentNotch += 1;
if (ControlGearBoxType == "C")
{
if (ThrottlePercent == 0)
{
GearBoxController.CurrentNotch += 1;
}
else
{
Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetString("Throttle must be reduced to Idle before gear change can happen."));
}
}
else
{
GearBoxController.CurrentNotch += 1;
}

if (GearBoxController.CurrentNotch > ControllerNumberOfGears)
{
GearBoxController.CurrentNotch = ControllerNumberOfGears;
}
else if (GearBoxController.CurrentNotch < 0)
{
GearBoxController.CurrentNotch = 0;
}

if(GearBoxController.CurrentNotch > ControllerNumberOfGears)
{
GearBoxController.CurrentNotch = ControllerNumberOfGears;
}
else if (GearBoxController.CurrentNotch < 0)
{
GearBoxController.CurrentNotch = 0;
}

ControlGearUp = true;
ControlGearDown = false;

}

public override void ChangeGearDown()
{
GearBoxController.CurrentNotch -= 1;
if (ControlGearBoxType == "C")
{
if (ThrottlePercent == 0)
{
GearBoxController.CurrentNotch -= 1;
}
else
{
Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetString("Throttle must be reduced to Idle before gear change can happen."));
}
}
else
{
GearBoxController.CurrentNotch -= 1;
}

if (GearBoxController.CurrentNotch > ControllerNumberOfGears)
{
Expand All @@ -303,9 +336,5 @@ public override void ChangeGearDown()
ControlGearDown = true;

}




}
}
Expand Up @@ -3637,10 +3637,9 @@ public virtual void StartGearBoxIncrease()
{
if (GearBoxController != null)
{

if (this is MSTSDieselLocomotive)
{

var dieselloco = this as MSTSDieselLocomotive;

if (dieselloco.DieselTransmissionType == MSTSDieselLocomotive.DieselTransmissionTypes.Mechanic)
Expand Down

0 comments on commit c9657de

Please sign in to comment.