uint it_x = TileX(it);
uint it_y = TileY(it);
uint max_it_x = it_x + as->size_x - 1;
uint max_it_y = it_y + as->size_y - 1;
while (!IsValidTile(TileXY(max_it_x, it_y))) max_it_x--;
while (!IsValidTile(TileXY(it_x, max_it_y))) max_it_y--;
if (TileX(cur_tile) == it_x || TileX(cur_tile) == max_it_x || TileY(cur_tile) == it_y || TileY(cur_tile) == max_it_y) {