added static functions to calculate route

This calculates the route recursively so it is insanely likely this will crash on a stack overflow if there are many trains and many switches. I have only tested it with a single train on a linear track so this is yet to be seen.