
We could simplify the code a little if we assume that all road ends have nodes (see the startsWithNode-stuff in RoadDef).
Yes, we could probably remove some code there.
Something else has just occurred to me. Hasn't it been reported previously that people were seeing the pink line go to the wrong end of motorways?
I'd assumed that these problems were fixed by your earlier patch, the one with the incorrect offsets.
I don't think so, I remember at least one person reporting seeing the routing line go to the wrong end of a motorway. Not to some random place, but to the end of the way it should have gone to. I attach a simplified version of my last patch - it now always increments the highways count for the end nodes. By doing that, we know that the resulting highway counts for the end nodes will always be one more than the real number of ways that join those nodes (if we ever need to know that).