* Handle the click on the nonstop button. * @param non_stop what non-stop type to use; std::nullopt to use the 'next' one. */
| 666 | * @param non_stop what non-stop type to use; std::nullopt to use the 'next' one. |
| 667 | */ |
| 668 | void OrderClick_Nonstop(std::optional<OrderNonStopFlags> non_stop) |
| 669 | { |
| 670 | if (!this->vehicle->IsGroundVehicle()) return; |
| 671 | |
| 672 | VehicleOrderID sel_ord = this->OrderGetSel(); |
| 673 | const Order *order = this->vehicle->GetOrder(sel_ord); |
| 674 | |
| 675 | if (order == nullptr || order->GetNonStopType() == non_stop) return; |
| 676 | |
| 677 | /* Keypress if no value, so 'toggle' to the next */ |
| 678 | if (!non_stop.has_value()) { |
| 679 | non_stop = order->GetNonStopType().Flip(OrderNonStopFlag::NoIntermediate); |
| 680 | } |
| 681 | |
| 682 | this->SetWidgetDirty(WID_O_NON_STOP); |
| 683 | Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index, sel_ord, MOF_NON_STOP, non_stop.value().base()); |
| 684 | } |
| 685 | |
| 686 | /** |
| 687 | * Handle the click on the skip button. |
no test coverage detected