Staging's switch fork running (#496) gave the axles and the vehicles state of their own: the way of a
switch an axle ran onto (TTrackFollower::iPath, which it leaves the switch by after a throw), the ways it
remembers of the switches behind it (path_memory, read when the axle behind it comes onto one of them),
and per vehicle the switch its bogies or its coupled ends run forked on with whether that was told
(m_forkbogies, m_forkends). None of it was in a snapshot: a loaded train on a switch thrown under it
would have left it by the way it is set now and never derailed running forked.
- Place() sets the way of the switch from the path the axle is put on, as SetCurrentTrack() does, and
clears the facing entry the vehicle hasn't looked at (there is none between frames).
- A vehicle entry has the remembered ways of each axle, oldest first (axle0switch0, axle0way0...),
recorded again into an empty memory on load (path_memory::entries()), and the forked watches
(forkbogies, fork0, fork1 with their "told"). A name which isn't a switch is refused.
- New case snapshot_td_switch_thrown: the snapshot is taken while the second coach of
eu07_td_switch_thrown_facing_behind_derails runs forked and hasn't derailed yet; the loaded run derails
it the same way and the two files at 150 s are identical.
- JoinedEnd() reads the track it is on once, without going through
LeavingPath()'s null check, which made the analyser think the track
could be null after it (S2259); the caller has checked it already
- the test loops count in integers (S2193, S886), one declaration a line
(S1659)
A new core module, world/switchfork.h, for forked running: two axles
that follow each other in a train on the two ways of a switch thrown
between them.
- leaving_path(): the way an axle leaves a switch by. Its own way only
when the switch was thrown since it ran onto it; -1 (as the switch is
set, the call of before) otherwise.
- path_memory: the ways of the last four switches an axle ran over.
- forked(): an axle that ran onto a switch from its points took
another way than the axle ahead of it.
- bogie_limit(): the angle a bogie turns under the body in the tightest
curve the vehicle runs through, asin(a / 2R); R is the Rmin of the
vehicle definition, or 150 m (TSI LOC&PAS 4.2.3.6) without one.
- buffer_head_width: 0.45 m (UIC 527-1), past which two coupled ends
have no buffer face against the other.
Unit tests: the coach of td.scn forked on its switch derails 23 m into
it, the EU07 at 10 m, a coupled coach at 15.5 m.