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

Method OrderClick_FullLoad

src/order_gui.cpp:595–608  ·  view source on GitHub ↗

* Handle the click on the full load button. * @param load_type Load flag to apply. If matches existing load type, toggles to default of 'load if possible'. * @param toggle If we toggle or not (used for hotkey behavior) */

Source from the content-addressed store, hash-verified

593 * @param toggle If we toggle or not (used for hotkey behavior)
594 */
595 void OrderClick_FullLoad(OrderLoadType load_type, bool toggle = false)
596 {
597 VehicleOrderID sel_ord = this->OrderGetSel();
598 const Order *order = this->vehicle->GetOrder(sel_ord);
599
600 if (order == nullptr) return;
601
602 if (toggle && order->GetLoadType() == load_type) {
603 load_type = OrderLoadType::LoadIfPossible; // reset to 'default'
604 }
605 if (order->GetLoadType() == load_type) return; // If we still match, do nothing
606
607 Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index, sel_ord, MOF_LOAD, to_underlying(load_type));
608 }
609
610 /**
611 * Handle the click on the service.

Callers 3

OnClickMethod · 0.95
OnDropdownSelectMethod · 0.95
OnHotkeyMethod · 0.95

Calls 4

OrderGetSelMethod · 0.95
to_underlyingFunction · 0.85
GetOrderMethod · 0.80
GetLoadTypeMethod · 0.80

Tested by

no test coverage detected