mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-15 15:19:52 +00:00
Change: clip content in purchase list to each row
This commit is contained in:
committed by
Peter Nelson
parent
0366278c9d
commit
e3dfd59df0
@@ -962,7 +962,7 @@ void DrawEngineList(VehicleType type, const Rect &r, const GUIEngineList &eng_li
|
||||
const int offset = (rtl ? -circle_width : circle_width) / 2;
|
||||
const int level_width = rtl ? -WidgetDimensions::scaled.hsep_indent : WidgetDimensions::scaled.hsep_indent;
|
||||
|
||||
for (auto it = first; it != last; ++it) {
|
||||
for (auto it = first; it != last; ++it, ir = ir.Translate(0, step_size)) {
|
||||
const auto &item = *it;
|
||||
const Engine *e = Engine::Get(item.engine_id);
|
||||
|
||||
@@ -971,6 +971,13 @@ void DrawEngineList(VehicleType type, const Rect &r, const GUIEngineList &eng_li
|
||||
bool is_folded = item.flags.Test(EngineDisplayFlag::IsFolded);
|
||||
bool shaded = item.flags.Test(EngineDisplayFlag::Shaded);
|
||||
|
||||
/* Set up clipping area for the row, keeping coordinates relative to the window. */
|
||||
DrawPixelInfo tmp_dpi;
|
||||
if (!FillDrawPixelInfo(&tmp_dpi, ir)) continue;
|
||||
tmp_dpi.left += ir.left;
|
||||
tmp_dpi.top += ir.top;
|
||||
AutoRestoreBackup dpi_backup(_cur_dpi, &tmp_dpi);
|
||||
|
||||
Rect textr = ir.Shrink(WidgetDimensions::scaled.matrix);
|
||||
Rect tr = ir.Indent(indent, rtl);
|
||||
|
||||
@@ -1146,8 +1153,6 @@ void DrawEngineList(VehicleType type, const Rect &r, const GUIEngineList &eng_li
|
||||
|
||||
/* The left/right bounds are adjusted to not overlap with the sort detail that is on the left/right depending on the RTL setting. */
|
||||
DrawString(tr.left + (rtl ? sort_detail_width : 0), tr.right - (rtl ? 0 : sort_detail_width), textr.top + normal_text_y_offset, name, tc);
|
||||
|
||||
ir = ir.Translate(0, step_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user