(svn r20223) -Codechange: Replace scrolled row calculations by a call to GetScrolledRowFromWidget().
This commit is contained in:
@@ -873,12 +873,7 @@ public:
|
||||
break;
|
||||
|
||||
case TDW_CENTERTOWN: { // Click on Town Matrix
|
||||
uint16 id_v = (pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height;
|
||||
|
||||
if (id_v >= this->vscroll.GetCapacity()) return; // click out of bounds
|
||||
|
||||
id_v += this->vscroll.GetPosition();
|
||||
|
||||
uint id_v = this->vscroll.GetScrolledRowFromWidget(pt.y, this, TDW_CENTERTOWN, WD_FRAMERECT_TOP);
|
||||
if (id_v >= this->towns.Length()) return; // click out of town bounds
|
||||
|
||||
const Town *t = this->towns[id_v];
|
||||
|
Reference in New Issue
Block a user