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

Method CanLeaveWithCargo

src/order_cmd.cpp:2200–2205  ·  view source on GitHub ↗

* A vehicle can leave the current station with cargo if: * 1. it can load cargo here OR * 2a. it could leave the last station with cargo AND * 2b. it doesn't have to unload all cargo here. */

Source from the content-addressed store, hash-verified

2198 * 2b. it doesn't have to unload all cargo here.
2199 */
2200bool Order::CanLeaveWithCargo(bool has_cargo) const
2201{
2202 return this->GetLoadType() != OrderLoadType::NoLoad || (has_cargo &&
2203 this->GetUnloadType() != OrderUnloadType::Unload &&
2204 this->GetUnloadType() != OrderUnloadType::Transfer);
2205}

Callers 2

LeaveStationMethod · 0.80
RefreshLinksMethod · 0.80

Calls 2

GetLoadTypeMethod · 0.95
GetUnloadTypeMethod · 0.95

Tested by

no test coverage detected