|
@@ -509,27 +509,27 @@ CargoArray GetProductionAroundTiles(Tile
|
|
|
|
|
|
assert(x1 < x2);
|
|
|
assert(y1 < y2);
|
|
|
assert(w > 0);
|
|
|
assert(h > 0);
|
|
|
|
|
|
std::set<IndustryID> industries;
|
|
|
TileArea ta(TileXY(x1, y1), TileXY(x2 - 1, y2 - 1));
|
|
|
|
|
|
/* Loop over all tiles to get the produced cargo of
|
|
|
* everything except industries */
|
|
|
TILE_AREA_LOOP(tile, ta) AddProducedCargo(tile, produced);
|
|
|
|
|
|
/* Loop over the industries. They produce cargo for
|
|
|
* anything that is within 'rad' from their bounding
|
|
|
* box. As such if you have e.g. a oil well the tile
|
|
|
* area loop might not hit an industry tile while
|
|
|
* the industry would produce cargo for the station.
|
|
|
TILE_AREA_LOOP(tile, ta) {
|
|
|
if (IsTileType(tile, MP_INDUSTRY)) industries.insert(GetIndustryIndex(tile));
|
|
|
AddProducedCargo(tile, produced);
|
|
|
}
|
|
|
|
|
|
/* Loop over the seen industries. They produce cargo for
|
|
|
* anything that is within 'rad' of any one of their tiles.
|
|
|
*/
|
|
|
const Industry *i;
|
|
|
FOR_ALL_INDUSTRIES(i) {
|
|
|
if (!ta.Intersects(i->location)) continue;
|
|
|
for (IndustryID industry : industries) {
|
|
|
const Industry *i = Industry::Get(industry);
|
|
|
/* Skip industry with neutral station */
|
|
|
if (i->neutral_station != NULL && !_settings_game.station.serve_neutral_industries) continue;
|
|
|
|
|
|
for (uint j = 0; j < lengthof(i->produced_cargo); j++) {
|
|
|
CargoID cargo = i->produced_cargo[j];
|
|
|
if (cargo != CT_INVALID) produced[cargo]++;
|