1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 02:12:37 +01:00

Add: Overlay cargo icon in vehicle/depot list when holding shift+ctrl. (#12938)

This commit is contained in:
Peter Nelson
2024-09-22 10:33:44 +01:00
committed by GitHub
parent 9404a03663
commit e45e8a39c8
9 changed files with 155 additions and 4 deletions

View File

@@ -106,6 +106,10 @@ void DrawTrainImage(const Train *v, const Rect &r, VehicleID selection, EngineIm
{
AutoRestoreBackup dpi_backup(_cur_dpi, &tmp_dpi);
bool do_overlays = ShowCargoIconOverlay();
/* List of overlays, only used if cargo icon overlays are enabled. */
static std::vector<CargoIconOverlay> overlays;
int px = rtl ? max_width + skip : -skip;
int y = r.Height() / 2;
bool sel_articulated = false;
@@ -143,9 +147,15 @@ void DrawTrainImage(const Train *v, const Rect &r, VehicleID selection, EngineIm
}
}
if (do_overlays) AddCargoIconOverlay(overlays, px, width, v);
px += rtl ? -width : width;
}
if (do_overlays) {
DrawCargoIconOverlays(overlays, y);
overlays.clear();
}
if (dragging && drag_at_end_of_train) {
/* Highlight the drag-and-drop destination at the end of the train. */
HighlightDragPosition(px, max_width, y, selection, _cursor.vehchain);