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

Method ShouldStopAtStation

src/order_cmd.cpp:2176–2184  ·  view source on GitHub ↗

* Check whether the given vehicle should stop at the given station * based on this order and the non-stop settings. * @param v the vehicle that might be stopping. * @param station the station to stop at. * @return true if the vehicle should stop. */

Source from the content-addressed store, hash-verified

2174 * @return true if the vehicle should stop.
2175 */
2176bool Order::ShouldStopAtStation(const Vehicle *v, StationID station) const
2177{
2178 bool is_dest_station = this->IsType(OT_GOTO_STATION) && this->dest == station;
2179
2180 return (!this->IsType(OT_GOTO_DEPOT) || this->GetDepotOrderType().Test(OrderDepotTypeFlag::PartOfOrders)) &&
2181 v->last_station_visited != station && // Do stop only when we've not just been there
2182 /* Finally do stop when there is no non-stop flag set for this type of station. */
2183 !this->GetNonStopType().Test(is_dest_station ? OrderNonStopFlag::NoDestination : OrderNonStopFlag::NoIntermediate);
2184}
2185
2186bool Order::CanLoadOrUnload() const
2187{

Callers 5

GetCurrentMaxSpeedMethod · 0.80
CheckNextTrainTileFunction · 0.80
ShowVisualEffectMethod · 0.80
VehicleEnter_StationFunction · 0.80

Calls 4

IsTypeMethod · 0.95
GetDepotOrderTypeMethod · 0.95
GetNonStopTypeMethod · 0.95
TestMethod · 0.80

Tested by

no test coverage detected