Station: Add field for number of station tiles
This commit is contained in:
@@ -1379,9 +1379,11 @@ void CheckCaches(bool force_check, std::function<void(const char *)> log)
|
||||
|
||||
std::vector<IndustryList> old_station_industries_nears;
|
||||
std::vector<BitmapTileArea> old_station_catchment_tiles;
|
||||
std::vector<uint> old_station_tiles;
|
||||
for (Station *st : Station::Iterate()) {
|
||||
old_station_industries_nears.push_back(st->industries_near);
|
||||
old_station_catchment_tiles.push_back(st->catchment_tiles);
|
||||
old_station_tiles.push_back(st->station_tiles);
|
||||
}
|
||||
|
||||
std::vector<StationList> old_industry_stations_nears;
|
||||
@@ -1424,6 +1426,9 @@ void CheckCaches(bool force_check, std::function<void(const char *)> log)
|
||||
if (!(old_station_catchment_tiles[i] == st->catchment_tiles)) {
|
||||
CCLOG("station catchment_tiles mismatch: st %i", (int)st->index);
|
||||
}
|
||||
if (!(old_station_tiles[i] == st->station_tiles)) {
|
||||
CCLOG("station station_tiles mismatch: st %i, (old: %u, new: %u)", (int)st->index, old_station_tiles[i], st->station_tiles);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -794,6 +794,7 @@ public:
|
||||
IndustryType indtype; ///< Industry type to get the name from
|
||||
|
||||
BitmapTileArea catchment_tiles; ///< NOSAVE: Set of individual tiles covered by catchment area
|
||||
uint station_tiles; ///< NOSAVE: Count of station tiles owned by this station
|
||||
|
||||
StationHadVehicleOfType had_vehicle_of_type;
|
||||
|
||||
|
@@ -738,6 +738,8 @@ class NIHStationStruct : public NIHelper {
|
||||
seprintf(buffer, lastof(buffer), " %u: %s", ind->index, ind->GetCachedName());
|
||||
print(buffer);
|
||||
}
|
||||
seprintf(buffer, lastof(buffer), " Station tiles: %u", st->station_tiles);
|
||||
print(buffer);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user