[z1906] Implement Pathfinder class to handle the actual pathfinding

Authors of this are Faramir118 and qsa.
Also thanks to many others for testing and suggestions!

(cleaned version of 22544f7)

(based on commit [s1487] - 3b7d7e5)