/closeup qualifier not working with $triggers dispose command in Monogame version 84. It works OK with $forms dispose command. I also checked Monogame 81 and it is not working there either.
Page 1 of 1
Time qualifier /closeup
#3
Posted 30 December 2020 - 02:32 PM
/closeup does not work with $triggers in the x1.3.1-275-ga389bc7c2 release. I have not used this combination before so I am not sure when or if it did in previous versions. According to the manual it should work with $forms, $static, and $triggers.
#4
Posted 01 January 2021 - 11:38 AM
I found this in the code of C#ProcessTimetable starting on line 3736 and ending on line 3796. There is an "if" for .TerminationFormed. Should there be a corresponding "if" for .TerminationTriggered?
switch (typeOfDispose)
{
case DisposeType.Forms:
case DisposeType.Triggers:
FormedTrain = String.Copy(trainCommands.CommandValues[0]);
FormType = formType;
FormTrain = true;
if (trainCommands.CommandQualifiers != null && formType == TTTrain.FormCommand.TerminationFormed)
{
foreach (TTTrainCommands.TTTrainComQualifiers formedTrainQualifiers in trainCommands.CommandQualifiers)
{
if (String.Compare(formedTrainQualifiers.QualifierName, "runround") == 0)
{
RunRound = true;
RunRoundPath = String.Copy(formedTrainQualifiers.QualifierValues[0]);
RunRoundTime = -1;
}
if (String.Compare(formedTrainQualifiers.QualifierName, "rrtime") == 0)
{
TimeSpan RRSpan;
TimeSpan.TryParse(formedTrainQualifiers.QualifierValues[0], out RRSpan);
RunRoundTime = Convert.ToInt32(RRSpan.TotalSeconds);
}
if (String.Compare(formedTrainQualifiers.QualifierName, "setstop") == 0)
{
SetStop = true;
}
if (String.Compare(formedTrainQualifiers.QualifierName, "atstation") == 0)
{
FormsAtStation = true;
}
if (String.Compare(formedTrainQualifiers.QualifierName, "closeup") == 0)
{
Closeup = true;
}
if (String.Compare(formedTrainQualifiers.QualifierName, "speed") == 0)
{
try
{
DisposeSpeed = Convert.ToSingle(formedTrainQualifiers.QualifierValues[0]);
}
catch
{
Trace.TraceInformation("Train : {0} : invalid value for runround speed : {1} \n", trainName, formedTrainQualifiers.QualifierValues[0]);
}
}
}
}
// reset speed if runround is not set
if (!RunRound && DisposeSpeed != null)
{
DisposeSpeed = null;
}
break;
// end of Forms and Triggers
switch (typeOfDispose)
{
case DisposeType.Forms:
case DisposeType.Triggers:
FormedTrain = String.Copy(trainCommands.CommandValues[0]);
FormType = formType;
FormTrain = true;
if (trainCommands.CommandQualifiers != null && formType == TTTrain.FormCommand.TerminationFormed)
{
foreach (TTTrainCommands.TTTrainComQualifiers formedTrainQualifiers in trainCommands.CommandQualifiers)
{
if (String.Compare(formedTrainQualifiers.QualifierName, "runround") == 0)
{
RunRound = true;
RunRoundPath = String.Copy(formedTrainQualifiers.QualifierValues[0]);
RunRoundTime = -1;
}
if (String.Compare(formedTrainQualifiers.QualifierName, "rrtime") == 0)
{
TimeSpan RRSpan;
TimeSpan.TryParse(formedTrainQualifiers.QualifierValues[0], out RRSpan);
RunRoundTime = Convert.ToInt32(RRSpan.TotalSeconds);
}
if (String.Compare(formedTrainQualifiers.QualifierName, "setstop") == 0)
{
SetStop = true;
}
if (String.Compare(formedTrainQualifiers.QualifierName, "atstation") == 0)
{
FormsAtStation = true;
}
if (String.Compare(formedTrainQualifiers.QualifierName, "closeup") == 0)
{
Closeup = true;
}
if (String.Compare(formedTrainQualifiers.QualifierName, "speed") == 0)
{
try
{
DisposeSpeed = Convert.ToSingle(formedTrainQualifiers.QualifierValues[0]);
}
catch
{
Trace.TraceInformation("Train : {0} : invalid value for runround speed : {1} \n", trainName, formedTrainQualifiers.QualifierValues[0]);
}
}
}
}
// reset speed if runround is not set
if (!RunRound && DisposeSpeed != null)
{
DisposeSpeed = null;
}
break;
// end of Forms and Triggers
#5
Posted 02 January 2021 - 08:41 AM
Unfortunately I am not a programmer and can not try this fix to the timetable code listed in message #4. Looking through the source code I think this change may get the /closeup qualifier and apparently other qualifiers to work with the $triggers command.
Replace line: if (trainCommands.CommandQualifiers != null && formType == TTTrain.FormCommand.TerminationFormed)
with this: if (trainCommands.CommandQualifiers != null && formType == TTTrain.FormCommand.TerminationFormed || trainCommands.CommandQualifiers != null && formType == TTTrain.FormCommand.TerminationTriggered)
I would be happy to test it if someone could make the change.
Replace line: if (trainCommands.CommandQualifiers != null && formType == TTTrain.FormCommand.TerminationFormed)
with this: if (trainCommands.CommandQualifiers != null && formType == TTTrain.FormCommand.TerminationFormed || trainCommands.CommandQualifiers != null && formType == TTTrain.FormCommand.TerminationTriggered)
I would be happy to test it if someone could make the change.
#6
Posted 07 January 2021 - 01:16 PM
Should I report this as a bug? I sent a message to Rob and he said my fix is correct but that he can not make the code change because his version is out of date.
#7
Posted 08 January 2021 - 01:24 AM
Yes, a bug report would be very helpful!
If you can handle Visual Studio, you could make and test that change yourself, and possibly even file a pull request to include your change in the main branch. Otherwise, one of us could make the change on your behalf...
If you can handle Visual Studio, you could make and test that change yourself, and possibly even file a pull request to include your change in the main branch. Otherwise, one of us could make the change on your behalf...
#8
Posted 08 January 2021 - 03:27 AM
I'll make a bug report. I can only view the code as I don't know how to make changes to it.
#9
Posted 18 January 2021 - 02:04 PM
Page 1 of 1