make selection box use the selection or deconstruct color to indicate the mode

This commit is contained in:
2026-08-14 21:49:55 +02:00
parent 9bbade2420
commit d36e59fd26
6 changed files with 19 additions and 8 deletions

View File

@@ -45,7 +45,6 @@ struct OverlayVisuals
QColor ghostValid;
QColor ghostInvalid;
QColor deconstructTint;
QColor selectionRect;
QColor tileHighlight;
QColor selectedOutline;
QColor configTransfer; // blueprint ghost over a transfer target (REQ-UI-BLUEPRINT-TRANSFER)

View File

@@ -221,7 +221,6 @@ VisualsConfig VisualsLoader::load(const std::string& path)
cfg.overlays.ghostValid = parseColor(requireString(ov, "ghost_valid", "overlays"), "overlays.ghost_valid");
cfg.overlays.ghostInvalid = parseColor(requireString(ov, "ghost_invalid", "overlays"), "overlays.ghost_invalid");
cfg.overlays.deconstructTint = parseColor(requireString(ov, "deconstruct_tint", "overlays"), "overlays.deconstruct_tint");
cfg.overlays.selectionRect = parseColor(requireString(ov, "selection_rect", "overlays"), "overlays.selection_rect");
cfg.overlays.tileHighlight = parseColor(requireString(ov, "tile_highlight", "overlays"), "overlays.tile_highlight");
cfg.overlays.selectedOutline = parseColor(requireString(ov, "selected_outline", "overlays"), "overlays.selected_outline");
cfg.overlays.configTransfer = parseColor(requireString(ov, "config_transfer", "overlays"), "overlays.config_transfer");

View File

@@ -1028,7 +1028,17 @@ void WorldRenderer::drawOverlays(QPainter& painter, const WorldCoordinates& coor
std::max(frame.boxStartTile.y(), frame.boxCurrentTile.y()) + 1);
const QRectF selRect(coordinates.tileToWidget(tl),
coordinates.tileToWidget(br));
painter.setPen(QPen(m_visuals.overlays.selectionRect, 1));
// In deconstruct mode the box marks buildings for demolition, so it is
// drawn in the deconstruct red instead of the selection color; the
// tint's alpha governs only the fills it tints, never this outline
// (REQ-UI-MULTI-SELECT, REQ-BLD-DECONSTRUCT-BOX).
QColor rectColor = m_visuals.overlays.selectedOutline;
if (frame.buildMode.isDeconstructMode())
{
rectColor = m_visuals.overlays.deconstructTint;
rectColor.setAlpha(255);
}
painter.setPen(QPen(rectColor, 1));
painter.setBrush(Qt::NoBrush);
painter.drawRect(selRect);
}