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

Function GetAcceptanceAroundTiles

src/station_cmd.cpp:571–586  ·  view source on GitHub ↗

* Get the acceptance of cargoes around the tile in 1/8. * @param center_tile Center of the search area * @param w X extent of area * @param h Y extent of area * @param rad Search radius in addition to given area * @param always_accepted bitmask of cargo accepted by houses and headquarters; can be nullptr * @param ind Industry associated with neutral station (e.g. oil rig) or nullptr */

Source from the content-addressed store, hash-verified

569 * @param ind Industry associated with neutral station (e.g. oil rig) or nullptr
570 */
571CargoArray GetAcceptanceAroundTiles(TileIndex center_tile, int w, int h, int rad, CargoTypes *always_accepted)
572{
573 CargoArray acceptance{};
574 if (always_accepted != nullptr) *always_accepted = 0;
575
576 TileArea ta = TileArea(center_tile, w, h).Expand(rad);
577
578 for (TileIndex tile : ta) {
579 /* Ignore industry if it has a neutral station. */
580 if (!_settings_game.station.serve_neutral_industries && IsTileType(tile, MP_INDUSTRY) && Industry::GetByTile(tile)->neutral_station != nullptr) continue;
581
582 AddAcceptedCargo(tile, acceptance, always_accepted);
583 }
584
585 return acceptance;
586}
587
588/**
589 * Get the acceptance of cargoes around the station in.

Callers 3

GetCargoAcceptanceMethod · 0.85

Calls 3

IsTileTypeFunction · 0.85
AddAcceptedCargoFunction · 0.85
ExpandMethod · 0.80

Tested by

no test coverage detected