From a924877e2035be58bb278fdb01569ba30f0a605f Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Mon, 20 Apr 2026 21:56:48 +0200 Subject: [PATCH] allow to demolish belts and splitters --- src/ui/GameWorldView.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/ui/GameWorldView.cpp b/src/ui/GameWorldView.cpp index 1390678..860c25e 100644 --- a/src/ui/GameWorldView.cpp +++ b/src/ui/GameWorldView.cpp @@ -396,6 +396,10 @@ EntityId GameWorldView::buildingAtTile(QPoint tile) const if (cell == tile) { return b.id; } } } + for (const BuildingSystem::BeltTileInfo& info : m_sim->buildings().allBeltTiles()) + { + if (info.tile == tile) { return info.id; } + } return kInvalidEntityId; } @@ -778,6 +782,17 @@ void GameWorldView::drawOverlays(QPainter& painter) painter.fillRect(tileRect(cell), m_visuals->overlays.demolishTint); } } + else + { + for (const BuildingSystem::BeltTileInfo& info : m_sim->buildings().allBeltTiles()) + { + if (info.id == m_demolishHoverId) + { + painter.fillRect(tileRect(info.tile), m_visuals->overlays.demolishTint); + break; + } + } + } } // Box-select rectangle @@ -956,8 +971,9 @@ void GameWorldView::mousePressEvent(QMouseEvent* event) if (hovered != kInvalidEntityId) { const Building* b = m_sim->buildings().findBuilding(hovered); - if (b && b->type != BuildingType::Hq - && b->type != BuildingType::PlayerDefenceStation) + const bool protected_ = b && (b->type == BuildingType::Hq + || b->type == BuildingType::PlayerDefenceStation); + if (!protected_) { m_sim->buildings().demolish(hovered); m_demolishHoverId = kInvalidEntityId;