fixed pathfinding bug

Some crashes were caused because accumulated cost was calculated with 8
directions (has diagonals) but pathfinding was only using 4 (no
diagonals). Added diagonals to pathfinding.