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

Function GetTileCatchmentRadius

src/station.cpp:311–337  ·  view source on GitHub ↗

* Get the catchment size of an individual station tile. * @param tile Station tile to get catchment size of. * @param st Associated station of station tile. * @pre IsTileType(tile, MP_STATION) * @return The catchment size of the station tile. */

Source from the content-addressed store, hash-verified

309 * @return The catchment size of the station tile.
310 */
311static uint GetTileCatchmentRadius(TileIndex tile, const Station *st)
312{
313 assert(IsTileType(tile, MP_STATION));
314
315 if (_settings_game.station.modified_catchment) {
316 switch (GetStationType(tile)) {
317 case StationType::Rail: return CA_TRAIN;
318 case StationType::Oilrig: return CA_UNMODIFIED;
319 case StationType::Airport: return st->airport.GetSpec()->catchment;
320 case StationType::Truck: return CA_TRUCK;
321 case StationType::Bus: return CA_BUS;
322 case StationType::Dock: return CA_DOCK;
323
324 default: NOT_REACHED();
325 case StationType::Buoy:
326 case StationType::RailWaypoint:
327 case StationType::RoadWaypoint: return CA_NONE;
328 }
329 } else {
330 switch (GetStationType(tile)) {
331 default: return CA_UNMODIFIED;
332 case StationType::Buoy:
333 case StationType::RailWaypoint:
334 case StationType::RoadWaypoint: return CA_NONE;
335 }
336 }
337}
338
339/**
340 * Determines the catchment radius of the station

Callers 1

RecomputeCatchmentMethod · 0.85

Calls 4

IsTileTypeFunction · 0.85
GetStationTypeFunction · 0.85
NOT_REACHEDFunction · 0.85
GetSpecMethod · 0.45

Tested by

no test coverage detected