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

@@ -132,6 +132,10 @@ void DrawRoadVehImage(const Vehicle *v, const Rect &r, VehicleID selection, Engi
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;
for (; u != nullptr && (rtl ? px > 0 : px < max_width); u = u->Next())
@@ -146,9 +150,15 @@ void DrawRoadVehImage(const Vehicle *v, const Rect &r, VehicleID selection, Engi
seq.Draw(px + (rtl ? -offset.x : offset.x), y + offset.y, pal, (u->vehstatus & VS_CRASHED) != 0);
}
if (do_overlays) AddCargoIconOverlay(overlays, px, width, u);
px += rtl ? -width : width;
}
if (do_overlays) {
DrawCargoIconOverlays(overlays, y);
overlays.clear();
}
if (v->index == selection) {
int height = ScaleSpriteTrad(12);
Rect hr = {(rtl ? px : 0), 0, (rtl ? max_width : px) - 1, height - 1};