From 97c173854106b7e901146d6f15ef155aefac81f5 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 24 Mar 2024 18:35:33 +0000 Subject: [PATCH] Fix #12368: Incorrect offset for click position within industry chain window. (#12370) --- src/industry_gui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index cf185cd3cb..70c83ccf73 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -3040,7 +3040,7 @@ struct IndustryCargoesWindow : public Window { pt.x -= nw->pos_x; pt.y -= nw->pos_y; - int vpos = WidgetDimensions::scaled.framerect.top + CargoesField::small_height - this->vscroll->GetPosition() * nw->resize_y; + int vpos = WidgetDimensions::scaled.frametext.top + CargoesField::small_height - this->vscroll->GetPosition() * nw->resize_y; if (pt.y < vpos) return false; int row = (pt.y - vpos) / CargoesField::normal_height; // row is relative to row 1. @@ -3048,7 +3048,7 @@ struct IndustryCargoesWindow : public Window { vpos = pt.y - vpos - row * CargoesField::normal_height; // Position in the row + 1 field row++; // rebase row to match index of this->fields. - int xpos = 2 * WidgetDimensions::scaled.framerect.left + ((this->ind_cargo < NUM_INDUSTRYTYPES) ? 0 : (CargoesField::industry_width + CargoesField::cargo_field_width) / 2); + int xpos = 2 * WidgetDimensions::scaled.frametext.left + ((this->ind_cargo < NUM_INDUSTRYTYPES) ? 0 : (CargoesField::industry_width + CargoesField::cargo_field_width) / 2); if (pt.x < xpos) return false; int column; for (column = 0; column <= 5; column++) {