MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ScriptTileList_IndustryProducing

Method ScriptTileList_IndustryProducing

src/script/api/script_tilelist.cpp:119–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119ScriptTileList_IndustryProducing::ScriptTileList_IndustryProducing(IndustryID industry_id, SQInteger radius)
120{
121 if (!ScriptIndustry::IsValidIndustry(industry_id) || radius <= 0) return;
122
123 const Industry *i = ::Industry::Get(industry_id);
124
125 /* Check if this industry is only served by its neutral station */
126 if (i->neutral_station != nullptr && !_settings_game.station.serve_neutral_industries) return;
127
128 /* Check if this industry produces anything */
129 if (!i->IsCargoProduced()) return;
130
131 if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED;
132
133 BitmapTileArea bta(TileArea(i->location).Expand(radius));
134 FillIndustryCatchment(i, radius, bta);
135
136 BitmapTileIterator it(bta);
137 for (TileIndex cur_tile = it; cur_tile != INVALID_TILE; cur_tile = ++it) {
138 this->AddTile(cur_tile);
139 }
140}
141
142ScriptTileList_StationType::ScriptTileList_StationType(StationID station_id, ScriptStation::StationType station_type)
143{

Callers

nothing calls this directly

Calls 4

FillIndustryCatchmentFunction · 0.85
IsCargoProducedMethod · 0.80
ExpandMethod · 0.80
AddTileMethod · 0.80

Tested by

no test coverage detected