| 89 | } |
| 90 | |
| 91 | ScriptTileList_IndustryAccepting::ScriptTileList_IndustryAccepting(IndustryID industry_id, SQInteger radius) |
| 92 | { |
| 93 | if (!ScriptIndustry::IsValidIndustry(industry_id) || radius <= 0) return; |
| 94 | |
| 95 | const Industry *i = ::Industry::Get(industry_id); |
| 96 | |
| 97 | /* Check if this industry is only served by its neutral station */ |
| 98 | if (i->neutral_station != nullptr && !_settings_game.station.serve_neutral_industries) return; |
| 99 | |
| 100 | /* Check if this industry accepts anything */ |
| 101 | if (!i->IsCargoAccepted()) return; |
| 102 | |
| 103 | if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED; |
| 104 | |
| 105 | BitmapTileArea bta(TileArea(i->location).Expand(radius)); |
| 106 | FillIndustryCatchment(i, radius, bta); |
| 107 | |
| 108 | BitmapTileIterator it(bta); |
| 109 | for (TileIndex cur_tile = it; cur_tile != INVALID_TILE; cur_tile = ++it) { |
| 110 | /* Only add the tile if it accepts the cargo (sometimes just 1 tile of an |
| 111 | * industry triggers the acceptance). */ |
| 112 | CargoArray acceptance = ::GetAcceptanceAroundTiles(cur_tile, 1, 1, radius); |
| 113 | if (std::none_of(std::begin(i->accepted), std::end(i->accepted), [&acceptance](const auto &a) { return ::IsValidCargoType(a.cargo) && acceptance[a.cargo] != 0; })) continue; |
| 114 | |
| 115 | this->AddTile(cur_tile); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | ScriptTileList_IndustryProducing::ScriptTileList_IndustryProducing(IndustryID industry_id, SQInteger radius) |
| 120 | { |
nothing calls this directly
no test coverage detected