* Calculate the selected order. * The calculation is based on the relative (to the window) y click position and * the position of the scrollbar. * * @param y Y-value of the click relative to the window origin * @return The selected order if the order is valid, else return \c INVALID_VEH_ORDER_ID. */
| 562 | * @return The selected order if the order is valid, else return \c INVALID_VEH_ORDER_ID. |
| 563 | */ |
| 564 | VehicleOrderID GetOrderFromPt(int y) |
| 565 | { |
| 566 | int32_t sel = this->vscroll->GetScrolledRowFromWidget(y, this, WID_O_ORDER_LIST, WidgetDimensions::scaled.framerect.top); |
| 567 | if (sel == INT32_MAX) return INVALID_VEH_ORDER_ID; |
| 568 | /* One past the orders is the 'End of Orders' line. */ |
| 569 | assert(IsInsideBS(sel, 0, vehicle->GetNumOrders() + 1)); |
| 570 | return sel; |
| 571 | } |
| 572 | |
| 573 | /** |
| 574 | * Handle the click on the goto button. |
no test coverage detected