I use this to check distances.
/**
* Finds the distance IN TILES between a pair of x,y coordinates
*/
inline int path_length(int x1, int y1, int x2, int y2)
{
return std::abs(x1 - x2) + std::abs(y1 - y2);
}
int enemy_distance = path_length(enemy->x, enemy->y, this->x, this->y);