|
@@ -413,13 +413,13 @@ void Station::RecomputeCatchment()
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (!_settings_game.station.serve_neutral_industries && this->industry != nullptr) {
|
|
|
/* Station is associated with an industry, so we only need to deliver to that industry. */
|
|
|
this->catchment_tiles.Initialize(this->industry->location);
|
|
|
TILE_AREA_LOOP(tile, this->industry->location) {
|
|
|
for (TileIndex tile : this->industry->location) {
|
|
|
if (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == this->industry->index) {
|
|
|
this->catchment_tiles.SetTile(tile);
|
|
|
}
|
|
|
}
|
|
|
/* The industry's stations_near may have been computed before its neutral station was built so clear and re-add here. */
|
|
|
for (Station *st : this->industry->stations_near) {
|
|
@@ -432,21 +432,21 @@ void Station::RecomputeCatchment()
|
|
|
}
|
|
|
|
|
|
this->catchment_tiles.Initialize(GetCatchmentRect());
|
|
|
|
|
|
/* Loop finding all station tiles */
|
|
|
TileArea ta(TileXY(this->rect.left, this->rect.top), TileXY(this->rect.right, this->rect.bottom));
|
|
|
TILE_AREA_LOOP(tile, ta) {
|
|
|
for (TileIndex tile : ta) {
|
|
|
if (!IsTileType(tile, MP_STATION) || GetStationIndex(tile) != this->index) continue;
|
|
|
|
|
|
uint r = GetTileCatchmentRadius(tile, this);
|
|
|
if (r == CA_NONE) continue;
|
|
|
|
|
|
/* This tile sub-loop doesn't need to test any tiles, they are simply added to the catchment set. */
|
|
|
TileArea ta2 = TileArea(tile, 1, 1).Expand(r);
|
|
|
TILE_AREA_LOOP(tile2, ta2) this->catchment_tiles.SetTile(tile2);
|
|
|
for (TileIndex tile2 : ta2) this->catchment_tiles.SetTile(tile2);
|
|
|
}
|
|
|
|
|
|
/* Search catchment tiles for towns and industries */
|
|
|
BitmapTileIterator it(this->catchment_tiles);
|
|
|
for (TileIndex tile = it; tile != INVALID_TILE; tile = ++it) {
|
|
|
if (IsTileType(tile, MP_HOUSE)) {
|
|
@@ -564,13 +564,13 @@ CommandCost StationRect::BeforeAddRect(T
|
|
|
* @param bottom_a Maximal tile Y edge of the rectangle (inclusive)
|
|
|
* @return \c true if a station tile with the given \a st_id exists in the rectangle, \c false otherwise
|
|
|
*/
|
|
|
/* static */ bool StationRect::ScanForStationTiles(StationID st_id, int left_a, int top_a, int right_a, int bottom_a)
|
|
|
{
|
|
|
TileArea ta(TileXY(left_a, top_a), TileXY(right_a, bottom_a));
|
|
|
TILE_AREA_LOOP(tile, ta) {
|
|
|
for (TileIndex tile : ta) {
|
|
|
if (IsTileType(tile, MP_STATION) && GetStationIndex(tile) == st_id) return true;
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
|