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

Method CancelReservation

src/vehicle.cpp:2311–2321  ·  view source on GitHub ↗

* Return all reserved cargo packets to the station and reset all packets * staged for transfer. * @param st the station where the reserved packets should go. */

Source from the content-addressed store, hash-verified

2309 * @param st the station where the reserved packets should go.
2310 */
2311void Vehicle::CancelReservation(StationID next, Station *st)
2312{
2313 for (Vehicle *v = this; v != nullptr; v = v->next) {
2314 VehicleCargoList &cargo = v->cargo;
2315 if (cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0) {
2316 Debug(misc, 1, "cancelling cargo reservation");
2317 cargo.Return(UINT_MAX, &st->goods[v->cargo_type].GetOrCreateData().cargo, next, v->tile);
2318 }
2319 cargo.KeepAll();
2320 }
2321}
2322
2323/**
2324 * Perform all actions when leaving a station.

Callers 2

PreDestructorMethod · 0.95
LeaveStationMethod · 0.95

Calls 3

ActionCountMethod · 0.80
KeepAllMethod · 0.80
ReturnMethod · 0.45

Tested by

no test coverage detected