static */
| 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 | { |
nothing calls this directly
no test coverage detected