Skip to content

Commit

Permalink
Cast MstsSignalFunction to SignalFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarBLG committed Sep 20, 2022
1 parent 6cdbdfe commit 68cd8ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 29 deletions.
28 changes: 1 addition & 27 deletions Source/Orts.Formats.Msts/SignalScripts.cs
Expand Up @@ -2513,33 +2513,7 @@ public SCRParameterType(SCRTermType TypeIn, int IntIn)
{
PartType = TypeIn;
PartParameter = IntIn;
switch(IntIn)
{
case 0:
SignalFunction = SignalFunction.NORMAL;
break;
case 1:
SignalFunction = SignalFunction.DISTANCE;
break;
case 2:
SignalFunction = SignalFunction.REPEATER;
break;
case 3:
SignalFunction = SignalFunction.SHUNTING;
break;
case 4:
SignalFunction = SignalFunction.INFO;
break;
case 5:
SignalFunction = SignalFunction.SPEED;
break;
case 6:
SignalFunction = SignalFunction.ALERT;
break;
default:
SignalFunction = SignalFunction.UNKNOWN;
break;
}
if (Enum.IsDefined(typeof(MstsSignalFunction), IntIn)) SignalFunction = new SignalFunction((MstsSignalFunction)IntIn);
}

// <summary>
Expand Down
10 changes: 8 additions & 2 deletions Source/Orts.Simulation/Simulation/Signalling/SIGSCRfile.cs
Expand Up @@ -529,7 +529,10 @@ public void SH_process_script(SignalHead thisHead, SignalScripts.SCRScripts sign
parameter1_value = SH_termvalue(thisHead, thisParameter,
localFloats, sigscr);

function1 = thisParameter.SignalFunction;
if (thisParameter.SignalFunction != null)
{
function1 = thisParameter.SignalFunction;
}
}

if (thisTerm.PartParameter.Length >= 2)
Expand All @@ -538,7 +541,10 @@ public void SH_process_script(SignalHead thisHead, SignalScripts.SCRScripts sign
parameter2_value = SH_termvalue(thisHead, thisParameter,
localFloats, sigscr);

function2 = thisParameter.SignalFunction;
if (thisParameter.SignalFunction != null)
{
function2 = thisParameter.SignalFunction;
}
}
}

Expand Down

0 comments on commit 68cd8ab

Please sign in to comment.