Not sure, but I only skimmed over the code as I don't have tim right now.

the only thing I saw was that you used a while() loop that may not work right...



while (maximum_distance > 0) && (my)
should be:
while ((maximum_distance > 0) && (my))


xXxGuitar511
- Programmer