Ok, the attached files appear to work on my installation. There was a another mistake in my code but I sorted it out and I got the code to work with a O.D.P. unit. The debug messages I added to see what really happened with the code revealed that the unitCannotMove callup is done some 20 times for each attempted unit movement, so clearly all the extra catching code should be worth the effort as to avoid unwanted lag.
I'll leave the code for you to test in a real game situation - I merely added units with the World Builder and tried to move them in and out of borders.
I'll leave the code for you to test in a real game situation - I merely added units with the World Builder and tried to move them in and out of borders.