Station: Add field for number of station tiles

This commit is contained in:
Jonathan G Rennison
2020-06-07 14:37:59 +01:00
parent c552e08ffe
commit 1917a3e0f8
4 changed files with 19 additions and 0 deletions

View File

@@ -447,6 +447,14 @@ void Station::RecomputeCatchment(bool no_clear_nearby_lists)
this->industry->stations_near.clear();
this->industry->stations_near.insert(this);
this->industries_near.insert(this->industry);
/* Loop finding all station tiles */
TileArea ta(TileXY(this->rect.left, this->rect.top), TileXY(this->rect.right, this->rect.bottom));
this->station_tiles = 0;
TILE_AREA_LOOP(tile, ta) {
if (!IsTileType(tile, MP_STATION) || GetStationIndex(tile) != this->index) continue;
this->station_tiles++;
}
return;
}
@@ -454,9 +462,12 @@ void Station::RecomputeCatchment(bool no_clear_nearby_lists)
/* Loop finding all station tiles */
TileArea ta(TileXY(this->rect.left, this->rect.top), TileXY(this->rect.right, this->rect.bottom));
this->station_tiles = 0;
TILE_AREA_LOOP(tile, ta) {
if (!IsTileType(tile, MP_STATION) || GetStationIndex(tile) != this->index) continue;
this->station_tiles++;
uint r = GetTileCatchmentRadius(tile, this);
if (r == CA_NONE) continue;