Fix runcost() for diagonal moves.

Probably fixes #1552.