summaryrefslogtreecommitdiff
path: root/src/town_gui.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-07-26 13:02:28 +0000
committeralberth <alberth@openttd.org>2010-07-26 13:02:28 +0000
commit3a1451644a0eae226545818adbde8a8a8c45eab7 (patch)
tree130026ba4b8d6f2d094d756f434671a4cbc52569 /src/town_gui.cpp
parent80cc566553ca1eb33566e0b05a49b7112d98718d (diff)
downloadopenttd-3a1451644a0eae226545818adbde8a8a8c45eab7.tar.xz
(svn r20221) -Codechange: Move unscrolled row calculation into a function.
Diffstat (limited to 'src/town_gui.cpp')
-rw-r--r--src/town_gui.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index bcab4560f..dc6864f20 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -259,8 +259,7 @@ public:
{
switch (widget) {
case TWA_COMMAND_LIST: {
- int y = (pt.y - this->GetWidget<NWidgetBase>(TWA_COMMAND_LIST)->pos_y - 1) / FONT_HEIGHT_NORMAL;
-
+ int y = this->GetRowFromWidget(pt.y, TWA_COMMAND_LIST, 1, FONT_HEIGHT_NORMAL);
if (!IsInsideMM(y, 0, 5)) return;
y = GetNthSetBit(GetMaskOfTownActions(NULL, _local_company, this->town), y + this->vscroll.GetPosition() - 1);