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

Function CanMoveGoodsToStation

src/station_cmd.cpp:4578–4597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4576
4577
4578static bool CanMoveGoodsToStation(const Station *st, CargoType cargo)
4579{
4580 /* Is the station reserved exclusively for somebody else? */
4581 if (st->owner != OWNER_NONE && st->town->exclusive_counter > 0 && st->town->exclusivity != st->owner) return false;
4582
4583 /* Lowest possible rating, better not to give cargo anymore. */
4584 if (st->goods[cargo].rating == 0) return false;
4585
4586 /* Selectively servicing stations, and not this one. */
4587 if (_settings_game.order.selectgoods && !st->goods[cargo].HasVehicleEverTriedLoading()) return false;
4588
4589 if (IsCargoInClass(cargo, CargoClass::Passengers)) {
4590 /* Passengers are never served by just a truck stop. */
4591 if (st->facilities == StationFacility::TruckStop) return false;
4592 } else {
4593 /* Non-passengers are never served by just a bus stop. */
4594 if (st->facilities == StationFacility::BusStop) return false;
4595 }
4596 return true;
4597}
4598
4599uint MoveGoodsToStation(CargoType cargo, uint amount, Source source, const StationList &all_stations, Owner exclusivity)
4600{

Callers 1

MoveGoodsToStationFunction · 0.85

Calls 2

IsCargoInClassFunction · 0.85

Tested by

no test coverage detected