diff options
-rw-r--r-- | src/industry_gui.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index db3ad4071..50e6b8be4 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -1290,7 +1290,7 @@ static const NWidgetPart _nested_industry_cargoes_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_BROWN), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_BROWN, ICW_PANEL), SetResize(1, 1), SetMinimalSize(200, 90), EndContainer(), + NWidget(WWT_PANEL, COLOUR_BROWN, ICW_PANEL), SetResize(1, 10), SetMinimalSize(200, 90), EndContainer(), NWidget(NWID_VERTICAL), NWidget(WWT_SCROLLBAR, COLOUR_BROWN, ICW_SCROLLBAR), NWidget(WWT_RESIZEBOX, COLOUR_BROWN), @@ -1300,7 +1300,7 @@ static const NWidgetPart _nested_industry_cargoes_widgets[] = { /** Window description for the industry cargoes window. */ static const WindowDesc _industry_cargoes_desc( - WDP_AUTO, 300, 200, + WDP_AUTO, 300, 210, WC_INDUSTRY_CARGOES, WC_NONE, 0, _nested_industry_cargoes_widgets, lengthof(_nested_industry_cargoes_widgets) @@ -2147,7 +2147,8 @@ struct IndustryCargoesWindow : public Window { this->ShortenCargoColumn(1, 1, num_indrows); this->ShortenCargoColumn(3, 1, num_indrows); - this->vscroll.SetCount(WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM + CargoesField::small_height + num_indrows * CargoesField::normal_height); + const NWidgetBase *nwp = this->GetWidget<NWidgetBase>(ICW_PANEL); + this->vscroll.SetCount(CeilDiv(WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM + CargoesField::small_height + num_indrows * CargoesField::normal_height, nwp->resize_y)); this->SetDirty(); } @@ -2210,7 +2211,8 @@ struct IndustryCargoesWindow : public Window { } this->ShortenCargoColumn(1, 1, num_indrows); - this->vscroll.SetCount(WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM + CargoesField::small_height + num_indrows * CargoesField::normal_height); + const NWidgetBase *nwp = this->GetWidget<NWidgetBase>(ICW_PANEL); + this->vscroll.SetCount(CeilDiv(WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM + CargoesField::small_height + num_indrows * CargoesField::normal_height, nwp->resize_y)); this->SetDirty(); } @@ -2239,7 +2241,8 @@ struct IndustryCargoesWindow : public Window { if (this->ind_cargo >= NUM_INDUSTRYTYPES) left_pos += (CargoesField::industry_width + CargoesField::CARGO_FIELD_WIDTH) / 2; int last_column = (this->ind_cargo < NUM_INDUSTRYTYPES) ? 4 : 2; - int vpos = -this->vscroll.GetPosition(); + const NWidgetBase *nwp = this->GetWidget<NWidgetBase>(ICW_PANEL); + int vpos = -this->vscroll.GetPosition() * nwp->resize_y; for (uint i = 0; i < this->fields.Length(); i++) { int row_height = (i == 0) ? CargoesField::small_height : CargoesField::normal_height; if (vpos + row_height >= 0) { @@ -2274,11 +2277,11 @@ struct IndustryCargoesWindow : public Window { */ bool CalculatePositionInWidget(Point pt, Point *fieldxy, Point *xy) { - NWidgetBase *nw = this->GetWidget<NWidgetBase>(ICW_PANEL); + const NWidgetBase *nw = this->GetWidget<NWidgetBase>(ICW_PANEL); pt.x -= nw->pos_x; pt.y -= nw->pos_y; - int vpos = WD_FRAMERECT_TOP + CargoesField::small_height - this->vscroll.GetPosition(); + int vpos = WD_FRAMERECT_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. |