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

Method GetOrderFlags

src/script/api/script_order.cpp:301–326  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

299}
300
301/* static */ ScriptOrder::ScriptOrderFlags ScriptOrder::GetOrderFlags(VehicleID vehicle_id, OrderPosition order_position)
302{
303 if (!IsValidVehicleOrder(vehicle_id, order_position)) return OF_INVALID;
304
305 const Order *order = ::ResolveOrder(vehicle_id, order_position);
306 if (order == nullptr || order->GetType() == OT_CONDITIONAL || order->GetType() == OT_DUMMY) return OF_INVALID;
307
308 ScriptOrderFlags order_flags = OF_NONE;
309 order_flags |= static_cast<ScriptOrderFlags>(order->GetNonStopType().base());
310 switch (order->GetType()) {
311 case OT_GOTO_DEPOT:
312 if (order->GetDepotOrderType().Test(OrderDepotTypeFlag::Service)) order_flags |= OF_SERVICE_IF_NEEDED;
313 if (order->GetDepotActionType().Test(OrderDepotActionFlag::Halt)) order_flags |= OF_STOP_IN_DEPOT;
314 if (order->GetDepotActionType().Test(OrderDepotActionFlag::NearestDepot)) order_flags |= OF_GOTO_NEAREST_DEPOT;
315 break;
316
317 case OT_GOTO_STATION:
318 order_flags |= static_cast<ScriptOrderFlags>(to_underlying(order->GetLoadType()) << 5);
319 order_flags |= static_cast<ScriptOrderFlags>(to_underlying(order->GetUnloadType()) << 2);
320 break;
321
322 default: break;
323 }
324
325 return order_flags;
326}
327
328/* static */ ScriptOrder::OrderPosition ScriptOrder::GetOrderJumpTo(VehicleID vehicle_id, OrderPosition order_position)
329{

Callers

nothing calls this directly

Calls 10

ResolveOrderFunction · 0.85
to_underlyingFunction · 0.85
GetNonStopTypeMethod · 0.80
TestMethod · 0.80
GetDepotOrderTypeMethod · 0.80
GetDepotActionTypeMethod · 0.80
GetLoadTypeMethod · 0.80
GetUnloadTypeMethod · 0.80
GetTypeMethod · 0.45
baseMethod · 0.45

Tested by

no test coverage detected