Feature: Non-rectangular sparse station catchment area.

This commit is contained in:
Peter Nelson
2019-02-14 21:07:15 +00:00
committed by PeterN
parent 3542ed53d4
commit 8b1b3fd0f9
13 changed files with 285 additions and 147 deletions

View File

@@ -573,15 +573,11 @@ bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type,
if (s->cargo_type != cargo_type || s->src_type != src_type || s->src != src) continue;
if (s->IsAwarded() && s->awarded != company) continue;
Rect rect = st->GetCatchmentRect();
for (int y = rect.top; y <= rect.bottom; y++) {
for (int x = rect.left; x <= rect.right; x++) {
TileIndex tile = TileXY(x, y);
if (!IsTileType(tile, MP_HOUSE)) continue;
const Town *t = Town::GetByTile(tile);
if (t->cache.part_of_subsidy & POS_DST) towns_near.Include(t);
}
BitmapTileIterator it(st->catchment_tiles);
for (TileIndex tile = it; tile != INVALID_TILE; tile = ++it) {
if (!IsTileType(tile, MP_HOUSE)) continue;
const Town *t = Town::GetByTile(tile);
if (t->cache.part_of_subsidy & POS_DST) towns_near.Include(t);
}
break;
}