MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / onOrderMove

Function onOrderMove

src/OpenLoco/src/Ui/Windows/Vehicle.cpp:2954–2973  ·  view source on GitHub ↗

0x004B4BC1 / 0x004B4C78 based on

Source from the content-addressed store, hash-verified

2952
2953 // 0x004B4BC1 / 0x004B4C78 based on
2954 static bool onOrderMove(Vehicles::VehicleHead* const head, const int16_t orderId, bool(orderMoveFunc)(Vehicles::VehicleHead*, uint32_t))
2955 {
2956 // No moveable orders
2957 if (head->sizeOfOrderTable <= 1)
2958 {
2959 return false;
2960 }
2961 // Valid orderId should be positive (avoid -1 / null)
2962 if (orderId < 0)
2963 {
2964 return false;
2965 }
2966
2967 auto* order = getOrderTable(head).atIndex(orderId);
2968 if (order != nullptr)
2969 {
2970 return orderMoveFunc(head, order->getOffset());
2971 }
2972 return false;
2973 }
2974
2975 // 0x004B4B43
2976 static void onMouseUp(Window& self, const WidgetIndex_t widgetIndex, [[maybe_unused]] const WidgetId id)

Callers 1

onMouseUpFunction · 0.85

Calls 3

getOrderTableFunction · 0.85
atIndexMethod · 0.80
getOffsetMethod · 0.80

Tested by

no test coverage detected