diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -509,7 +509,7 @@ static void TransportIndustryGoods(TileI const IndustrySpec *indspec = GetIndustrySpec(i->type); bool moved_cargo = false; - StationFinder stations(i->xy, i->width, i->height); + StationFinder stations(TileArea(i->xy, i->width, i->height)); for (uint j = 0; j < lengthof(i->produced_cargo_waiting); j++) { uint cw = min(i->produced_cargo_waiting[j], 255); diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3035,7 +3035,7 @@ void FindStationsAroundTiles(TileIndex t const StationList *StationFinder::GetStations() { if (this->tile != INVALID_TILE) { - FindStationsAroundTiles(this->tile, this->x_extent, this->y_extent, &this->stations); + FindStationsAroundTiles(this->tile, this->w, this->h, &this->stations); this->tile = INVALID_TILE; } return &this->stations; diff --git a/src/station_type.h b/src/station_type.h --- a/src/station_type.h +++ b/src/station_type.h @@ -99,19 +99,14 @@ typedef SmallVector Statio * Structure contains cached list of stations nearby. The list * is created upon first call to GetStations() */ -class StationFinder { +class StationFinder : TileArea { StationList stations; ///< List of stations nearby - TileIndex tile; ///< Northern tile of producer, INVALID_TILE when # stations is valid - int x_extent; ///< Width of producer - int y_extent; ///< Height of producer public: /** * Constructs StationFinder - * @param t northern tile - * @param dx width of producer - * @param dy height of producer + * @param area the area to search from */ - StationFinder(TileIndex t, int dx, int dy) : tile(t), x_extent(dx), y_extent(dy) {} + StationFinder(const TileArea &area) : TileArea(area) {} const StationList *GetStations(); }; diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -465,7 +465,7 @@ static void TileLoop_Town(TileIndex tile Town *t = Town::GetByTile(tile); uint32 r = Random(); - StationFinder stations(tile, 1, 1); + StationFinder stations(TileArea(tile, 1, 1)); if (HasBit(hs->callback_mask, CBM_HOUSE_PRODUCE_CARGO)) { for (uint i = 0; i < 256; i++) { diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp --- a/src/unmovable_cmd.cpp +++ b/src/unmovable_cmd.cpp @@ -343,7 +343,7 @@ static void TileLoop_Unmovable(TileIndex uint level = GetCompanyHQSize(tile) + 1; assert(level < 6); - StationFinder stations(tile, 2, 2); + StationFinder stations(TileArea(tile, 2, 2)); uint r = Random(); /* Top town buildings generate 250, so the top HQ type makes 256. */