allow to demolish belts and splitters
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user