648 TileIndex found_spot[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE * 4]; |
648 TileIndex found_spot[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE * 4]; |
649 uint found_best[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE * 4]; |
649 uint found_best[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE * 4]; |
650 // To find a good spot we scan a range from the center, a get the point |
650 // To find a good spot we scan a range from the center, a get the point |
651 // where we get the most cargo and where it is buildable. |
651 // where we get the most cargo and where it is buildable. |
652 // TODO: also check for station of myself and make sure we are not |
652 // TODO: also check for station of myself and make sure we are not |
653 // taking eachothers passangers away (bad result when it does not) |
653 // taking eachothers passengers away (bad result when it does not) |
654 for (x = TileX(tile) - AI_FINDSTATION_TILE_RANGE; x <= TileX(tile) + AI_FINDSTATION_TILE_RANGE; x++) { |
654 for (x = TileX(tile) - AI_FINDSTATION_TILE_RANGE; x <= TileX(tile) + AI_FINDSTATION_TILE_RANGE; x++) { |
655 for (y = TileY(tile) - AI_FINDSTATION_TILE_RANGE; y <= TileY(tile) + AI_FINDSTATION_TILE_RANGE; y++) { |
655 for (y = TileY(tile) - AI_FINDSTATION_TILE_RANGE; y <= TileY(tile) + AI_FINDSTATION_TILE_RANGE; y++) { |
656 new_tile = TileXY(x, y); |
656 new_tile = TileXY(x, y); |
657 if (IsTileType(new_tile, MP_CLEAR) || IsTileType(new_tile, MP_TREES)) { |
657 if (IsTileType(new_tile, MP_CLEAR) || IsTileType(new_tile, MP_TREES)) { |
658 // This tile we can build on! |
658 // This tile we can build on! |