static */
| 531 | } |
| 532 | |
| 533 | /* static */ bool ScriptOrder::InsertConditionalOrder(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to) |
| 534 | { |
| 535 | /* IsValidVehicleOrder is not good enough because it does not allow appending. */ |
| 536 | if (order_position == ORDER_CURRENT) order_position = ScriptOrder::ResolveOrderPosition(vehicle_id, order_position); |
| 537 | |
| 538 | EnforceCompanyModeValid(false); |
| 539 | EnforcePrecondition(false, ScriptVehicle::IsPrimaryVehicle(vehicle_id)); |
| 540 | EnforcePrecondition(false, order_position >= 0 && order_position <= ::Vehicle::Get(vehicle_id)->GetNumManualOrders()); |
| 541 | EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, jump_to) && jump_to != ORDER_CURRENT); |
| 542 | |
| 543 | Order order; |
| 544 | int jump_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, jump_to); |
| 545 | order.MakeConditional(jump_pos); |
| 546 | |
| 547 | int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position); |
| 548 | return ScriptObject::Command<CMD_INSERT_ORDER>::Do(0, vehicle_id, order_pos, order); |
| 549 | } |
| 550 | |
| 551 | /* static */ bool ScriptOrder::RemoveOrder(VehicleID vehicle_id, OrderPosition order_position) |
| 552 | { |
nothing calls this directly
no test coverage detected