I'm going to have to bring this up again.
vee41, are there restrictions or situations where the movement highlighting does not work? It seems to only work 'forward' and not account for spaces behind the object.
For example, I am implementing highlighting of squares a program can attack. It uses essentially the same function.
<img src="http://i.imgur.com/VccStqs.png" border="0">
However, only squares that are 'forward' seem to be highlighted, with some to the side completely ignored.
<img src="http://i.imgur.com/uyyLPlV.png" border="0">
The same applies for program movement, although I've largely ignored it up til now because it seemed to 'fix' itself if you moved toward a square you should be able to move toward anyway. Here's an example of squares not being highlighted for movement.
<img src="http://i.imgur.com/pisYOCd.png" border="0">
The .capx in case you want to run and fire up the debugger to take a look:
UPDATE: I've determined that the function doesn't check for spaces around corners. vee41, do you know how to accommodate for that?