Entities can get stuck inside short-pathfinder obstruction boundaries, making them compute short paths that they actually can't take. This was first reported here. It's pretty much unfixable.
However, the stuckiness can be fixed by computing a long-path occasionally.
Because of an off-by-one error, that sometimes never worked. This fixes it.
It also reintroduces larger max_range as a value of 6 is rather low.
This is a mixup for rP22609, which contained the off-by-one error, and a partial 'revert' of rP22526 (for the max range).
Reported by Freagarach along with a very helpful minimal replay.