diff options
author | alberth <alberth@openttd.org> | 2009-12-22 11:22:07 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-12-22 11:22:07 +0000 |
commit | 96a8a0f34da838df85a683d87870822288ad36f6 (patch) | |
tree | d66d922c4df037fe137c1b1014c5e4c8f5309cea | |
parent | 4733b696a1833ecbbc5dd6ac873ec3396c8f5bfa (diff) | |
download | openttd-96a8a0f34da838df85a683d87870822288ad36f6.tar.xz |
(svn r18601) -Codechange: Use resize step of the order list panel widget for order line calculations.
-rw-r--r-- | src/order_gui.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 896697ba8..13abe86f1 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -491,7 +491,8 @@ private: */ int GetOrderFromPt(int y) { - 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. + NWidgetBase *nwid = this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST); + int sel = (y - nwid->pos_y - WD_FRAMERECT_TOP) / nwid->resize_y; // Selected line in the ORDER_WIDGET_ORDER_LIST panel. if ((uint)sel >= this->vscroll.GetCapacity()) return INVALID_ORDER; @@ -943,6 +944,7 @@ public: int middle = rtl ? r.right - WD_FRAMETEXT_RIGHT - index_column_width : r.left + WD_FRAMETEXT_LEFT + index_column_width; int y = r.top + WD_FRAMERECT_TOP; + int line_height = this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST)->resize_y; int i = this->vscroll.GetPosition(); const Order *order = this->vehicle->GetOrder(i); @@ -952,7 +954,7 @@ public: if (!this->vscroll.IsVisible(i)) break; DrawOrderString(this->vehicle, order, i, y, i == this->selected_order, false, r.left + WD_FRAMETEXT_LEFT, middle, r.right - WD_FRAMETEXT_RIGHT); - y += this->resize.step_height; + y += line_height; i++; order = order->next; |