also use surface_mask to draw belts and splitters

This commit is contained in:
2026-04-24 21:13:12 +02:00
parent 55997ef851
commit 604ad7f13f

View File

@@ -538,23 +538,10 @@ void GameWorldView::drawBuildings(QPainter& painter)
painter.fillRect(tileRect(cell), bv.fill); painter.fillRect(tileRect(cell), bv.fill);
} }
// Belts and splitters are 1×1 on their body cell; other buildings use
// the full footprint bounding box for their outline and glyph.
QRectF bboxRect;
const bool isBeltLike = (b.type == BuildingType::Belt
|| b.type == BuildingType::Splitter);
if (isBeltLike && !b.bodyCells.empty())
{
const QPointF tl = tileToWidget(b.bodyCells[0]);
bboxRect = QRectF(tl.x(), tl.y(), tilePx(), tilePx());
}
else
{
const QPointF tl = tileToWidget(b.anchor); const QPointF tl = tileToWidget(b.anchor);
bboxRect = QRectF(tl.x(), tl.y(), const QRectF bboxRect(tl.x(), tl.y(),
b.footprint.width() * static_cast<qreal>(tilePx()), b.footprint.width() * static_cast<qreal>(tilePx()),
b.footprint.height() * static_cast<qreal>(tilePx())); b.footprint.height() * static_cast<qreal>(tilePx()));
}
painter.setPen(QPen(bv.outline, 1)); painter.setPen(QPen(bv.outline, 1));
painter.setBrush(Qt::NoBrush); painter.setBrush(Qt::NoBrush);