mirror of https://github.com/OpenTTD/OpenTTD
parent
8ae15d9797
commit
671a310d21
|
@ -57,7 +57,7 @@ public:
|
||||||
* Initialize the BitmapTileArea with the specified Rect.
|
* Initialize the BitmapTileArea with the specified Rect.
|
||||||
* @param rect Rect to use.
|
* @param rect Rect to use.
|
||||||
*/
|
*/
|
||||||
void Initialize(Rect r)
|
void Initialize(const Rect &r)
|
||||||
{
|
{
|
||||||
this->tile = TileXY(r.left, r.top);
|
this->tile = TileXY(r.left, r.top);
|
||||||
this->w = r.right - r.left + 1;
|
this->w = r.right - r.left + 1;
|
||||||
|
@ -66,6 +66,15 @@ public:
|
||||||
this->data.resize(Index(w, h));
|
this->data.resize(Index(w, h));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Initialize(const TileArea &ta)
|
||||||
|
{
|
||||||
|
this->tile = ta.tile;
|
||||||
|
this->w = ta.w;
|
||||||
|
this->h = ta.h;
|
||||||
|
this->data.clear();
|
||||||
|
this->data.resize(Index(w, h));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a tile as part of the tile area.
|
* Add a tile as part of the tile area.
|
||||||
* @param tile Tile to add.
|
* @param tile Tile to add.
|
||||||
|
|
|
@ -421,10 +421,10 @@ void Station::RecomputeCatchment()
|
||||||
this->catchment_tiles.Reset();
|
this->catchment_tiles.Reset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->catchment_tiles.Initialize(GetCatchmentRect());
|
|
||||||
|
|
||||||
if (!_settings_game.station.serve_neutral_industries && this->industry != nullptr) {
|
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. */
|
/* 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) {
|
TILE_AREA_LOOP(tile, this->industry->location) {
|
||||||
if (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == this->industry->index) {
|
if (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == this->industry->index) {
|
||||||
this->catchment_tiles.SetTile(tile);
|
this->catchment_tiles.SetTile(tile);
|
||||||
|
@ -440,6 +440,8 @@ void Station::RecomputeCatchment()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->catchment_tiles.Initialize(GetCatchmentRect());
|
||||||
|
|
||||||
/* Loop finding all station tiles */
|
/* Loop finding all station tiles */
|
||||||
TileArea ta(TileXY(this->rect.left, this->rect.top), TileXY(this->rect.right, this->rect.bottom));
|
TileArea ta(TileXY(this->rect.left, this->rect.top), TileXY(this->rect.right, this->rect.bottom));
|
||||||
TILE_AREA_LOOP(tile, ta) {
|
TILE_AREA_LOOP(tile, ta) {
|
||||||
|
|
Loading…
Reference in New Issue