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

Method OrderClick_Nonstop

src/order_gui.cpp:668–684  ·  view source on GitHub ↗

* Handle the click on the nonstop button. * @param non_stop what non-stop type to use; std::nullopt to use the 'next' one. */

Source from the content-addressed store, hash-verified

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.

Callers 3

OnClickMethod · 0.95
OnDropdownSelectMethod · 0.95
OnHotkeyMethod · 0.95

Calls 7

OrderGetSelMethod · 0.95
GetOrderMethod · 0.80
GetNonStopTypeMethod · 0.80
SetWidgetDirtyMethod · 0.80
IsGroundVehicleMethod · 0.45
baseMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected