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

Method OrderClick_Refit

src/order_gui.cpp:744–756  ·  view source on GitHub ↗

* Handle the click on the refit button. * If ctrl is pressed, cancel refitting, else show the refit window. * @param i Selected refit command. * @param auto_refit Select refit for auto-refitting. */

Source from the content-addressed store, hash-verified

742 * @param auto_refit Select refit for auto-refitting.
743 */
744 void OrderClick_Refit(int i, bool auto_refit)
745 {
746 if (_ctrl_pressed) {
747 /* Cancel refitting */
748 Command<CMD_ORDER_REFIT>::Post(this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), CARGO_NO_REFIT);
749 } else {
750 if (i == 1) { // Auto-refit to available cargo type.
751 Command<CMD_ORDER_REFIT>::Post(this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), CARGO_AUTO_REFIT);
752 } else {
753 ShowVehicleRefitWindow(this->vehicle, this->OrderGetSel(), this, auto_refit);
754 }
755 }
756 }
757
758 /** Cache auto-refittability of the vehicle chain. */
759 void UpdateAutoRefitState()

Callers 2

OnClickMethod · 0.95
OnDropdownSelectMethod · 0.95

Calls 2

OrderGetSelMethod · 0.95
ShowVehicleRefitWindowFunction · 0.85

Tested by

no test coverage detected