fix issue where construction sites could not be selected

This commit is contained in:
2026-04-27 22:06:44 +02:00
parent 559dde96cf
commit d64a7a5dd9
2 changed files with 78 additions and 5 deletions

View File

@@ -1067,7 +1067,11 @@ void GameWorldView::mousePressEvent(QMouseEvent* event)
}
else
{
const EntityId id = buildingAtTile(tile);
EntityId id = buildingAtTile(tile);
if (id == kInvalidEntityId)
{
id = siteAtTile(tile);
}
if (id != kInvalidEntityId)
{
if (event->modifiers() & Qt::ControlModifier)
@@ -1162,6 +1166,18 @@ void GameWorldView::mouseReleaseEvent(QMouseEvent* event)
}
}
}
for (const ConstructionSite& s : m_sim->buildings().allSites())
{
for (const QPoint& cell : s.bodyCells)
{
if (cell.x() >= x0 && cell.x() <= x1
&& cell.y() >= y0 && cell.y() <= y1)
{
boxSel.push_back(s.id);
break;
}
}
}
if (!(event->modifiers() & Qt::ControlModifier))
{