allow multi-select for ships/stations, mixable with scrap

This commit is contained in:
2026-07-20 20:39:48 +02:00
parent 9622fa4345
commit be475e2836
15 changed files with 509 additions and 206 deletions

View File

@@ -15,7 +15,7 @@
#include "Building.h"
#include "BuildingSystem.h"
#include "EntityHitTest.h"
#include "EntitySelectedEvent.h"
#include "EntitySelectionChangedEvent.h"
#include "EventManager.h"
#include "FacingComponent.h"
#include "FactionComponent.h"
@@ -259,8 +259,14 @@ void ArenaView::mousePressEvent(QMouseEvent* event)
m_selectedEntity = std::nullopt;
}
// The arena is strictly single-select; emit a vector of size 0 or 1.
std::vector<entt::entity> selection;
if (m_selectedEntity.has_value())
{
selection.push_back(*m_selectedEntity);
}
EventManager::getInstance()->sendEventImmediately(
std::make_shared<EntitySelectedEvent>(m_selectedEntity));
std::make_shared<EntitySelectionChangedEvent>(selection));
}
QOpenGLWidget::mousePressEvent(event);