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

Method OrderClick_Service

src/order_gui.cpp:613–623  ·  view source on GitHub ↗

* Handle the click on the service. */

Source from the content-addressed store, hash-verified

611 * Handle the click on the service.
612 */
613 void OrderClick_Service(std::optional<OrderDepotAction> i)
614 {
615 VehicleOrderID sel_ord = this->OrderGetSel();
616
617 if (!i.has_value()) {
618 const Order *order = this->vehicle->GetOrder(sel_ord);
619 if (order == nullptr) return;
620 i = order->GetDepotOrderType().Test(OrderDepotTypeFlag::Service) ? OrderDepotAction::AlwaysGo : OrderDepotAction::Service;
621 }
622 Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index, sel_ord, MOF_DEPOT_ACTION, to_underlying(i.value()));
623 }
624
625 /**
626 * Handle the click on the service in nearest depot button.

Callers 2

OnDropdownSelectMethod · 0.95
OnHotkeyMethod · 0.95

Calls 6

OrderGetSelMethod · 0.95
to_underlyingFunction · 0.85
GetOrderMethod · 0.80
TestMethod · 0.80
GetDepotOrderTypeMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected