Refactor non-distant land terrain path to a grid based implementation (Fixes #1562)