|
@@ -472,13 +472,13 @@ private:
|
|
|
*
|
|
|
* @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_ORDER.
|
|
|
*/
|
|
|
int GetOrderFromPt(int y)
|
|
|
{
|
|
|
int sel = (y - this->GetWidget(ORDER_WIDGET_ORDER_LIST)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height; // Selected line in the ORDER_WIDGET_ORDER_LIST panel.
|
|
|
int sel = (y - this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height; // Selected line in the ORDER_WIDGET_ORDER_LIST panel.
|
|
|
|
|
|
if ((uint)sel >= this->vscroll.GetCapacity()) return INVALID_ORDER;
|
|
|
|
|
|
sel += this->vscroll.GetPosition();
|
|
|
|
|
|
return (sel <= vehicle->GetNumOrders() && sel >= 0) ? sel : INVALID_ORDER;
|
|
@@ -677,13 +677,13 @@ public:
|
|
|
|
|
|
this->InitNested(desc, v->index);
|
|
|
|
|
|
this->selected_order = -1;
|
|
|
this->owner = v->owner;
|
|
|
|
|
|
int num_lines = (this->GetWidget(ORDER_WIDGET_ORDER_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height;
|
|
|
int num_lines = (this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height;
|
|
|
this->vscroll.SetCapacity(num_lines);
|
|
|
|
|
|
if (_settings_client.gui.quick_goto && v->owner == _local_company) {
|
|
|
/* If there are less than 2 station, make Go To active. */
|
|
|
int station_orders = 0;
|
|
|
const Order *order;
|
|
@@ -1231,13 +1231,13 @@ public:
|
|
|
}
|
|
|
|
|
|
virtual void OnPlaceObjectAbort()
|
|
|
{
|
|
|
if (this->goto_type == OPOS_CONDITIONAL) {
|
|
|
this->goto_type = OPOS_GOTO;
|
|
|
NWidgetBase *nwid = this->GetWidget(ORDER_WIDGET_ORDER_LIST);
|
|
|
NWidgetBase *nwid = this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST);
|
|
|
if (IsInsideBS(_cursor.pos.x, this->left + nwid->pos_x, nwid->current_x) && IsInsideBS(_cursor.pos.y, this->top + nwid->pos_y, nwid->current_y)) {
|
|
|
int order_id = this->GetOrderFromPt(_cursor.pos.y - this->top);
|
|
|
if (order_id != INVALID_ORDER) {
|
|
|
Order order;
|
|
|
order.next = NULL;
|
|
|
order.index = 0;
|