The signal limit in Explorer mode is a known issue which has been around since the 'new' signalling code was created.
It was introduced because it was envisaged that explorer mode would only be used to, well, explore the route, hopping about, checking branches and sidings etc., and not to run trains as one would do in 'normal' mode.
Well, apparantly that assumption was wrong - my fault.
I can appreciate the need to change this in explorer mode, but the way this change has been implemented is completely wrong.
I had a look at the new code and I can only assume that it has been set up this way due to a complete misunderstanding of the use of the minCheckDistanceM constant.
So, first I will explain the use of this constant. It's intended use is only for signal initiation. The maximum distance defined in minCheckDistanceM is only intended to avoid a needless search along lengthy paths for signals which probably are not there, or are so far out as not to affect the train when it is started.
Actually, the signalling does not just use this constant, but it uses either this constant or a range depending on max. speed and time required to stop for a signal at danger, whatever distance is further. This choice was introduced to avoid problems with trains entering the sim at speed and not finding the first signal in time.
As soon as the first signal is found, the constant will not be used anymore in any way. From that moment on, the search for further signals in dictated by the signal logic.
A 'side' use for this variable is in the deadlock processing. A check is made for a common section if this section is protected by signals. Again, it's no use checking the full path, so again this variable is used to limit the search. It takes a lot of imagination to assume a signal at certain location is actually protecting a junction some 10 miles away. That's just not how signalling works in real life.
Then to explorer mode. This same constant was used - or abused, if you like - to set up the limits for the checks in explorer mode as explained above. But this certainly is not the main function of this constant.
So, if a change is needed in explorer mode to extend the search, the first thing to do is to drop the use of this constant. This use is not what this constant is intended for, so leave it to its intended function and set up another limit check for explorer.
What this change has introduced is that the search limit for the first signal is based on the location of the first signal. Even writing it down makes no sense.
It makes it all needlessly complicated, and its useless for, as stated, once a signal is found the constant is not used anymore.
So I would strongly suggest to revert this change and restore the constant for use in signal initiation and deadlock processing. It's clear, it's simple, and it has been working without any problems for many years.
That leaves the point of what to do with explorer mode. The method where this is all done is CheckExplorerPath, and that is where the changes should be made, and those changes need to be restricted to this method.
One option is to use the calculation as now introduced, but obviously for explorer mode only. But I would argue against that as it is needlessly complicated.
Another option is to determine the maximum scan range in a similar way as for signal initiation, that is either based on this constant, or on the product of max. speed and required reaction time. The reaction time of the TCS systems in known so this would be a quite simple and clear change.
The best option, however, is simply to remove the scan restriction alltogether. By removing the constant minCheckDistanceM from the call to ScanRoute and replacing it by the value -1, the scan is performed for the full (remaining) route of the train, which is similar as to its use in other modes. The only problem could be the bit of code following the scan, which extands or shrinks the scanned area based on the train's progress along its route. It would need to be tested what should be done with this bit of logic, but it's quite well possible it can be removed completely. Removing the scan limit will sort all problems and will make behaviour of the signalling in explorer mode much more like that in the normal modes.
So this is what I would suggest :
- Revert the changes which introduced the present problems, and restore the constant minCheckDistanceM for signal initiation and deadlock processing.
- Remove the scan limit from ScanRoute in CheckExplorerPath.
- Test what needs to be done with the logic which expands and shrinks the path in explorer mode, also in CheckExplorerPath.
This will keep the code clean and simple, restores the working of signal initiation and deadlock to what it was, and sorts the problems in explorer mode.
As bonus, behaviour of signalling in explorer mode will be more like that in normal mode.
Regards,
Rob Roeterdink