Rename EntitySelectedEvent to EntitySelectionChangedEvent
The event also fires on deselection and now carries a set of entities rather than a single one, so the "SelectionChanged" name (matching SelectionChangedEvent and ScrapSelectionChangedEvent) is more accurate. Pure rename: header + include guard, CMake entry, and all usages. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y7N59FsLA5e2kuVdqe4Uhc
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
#include "Building.h"
|
#include "Building.h"
|
||||||
#include "BuildingSystem.h"
|
#include "BuildingSystem.h"
|
||||||
#include "EntityHitTest.h"
|
#include "EntityHitTest.h"
|
||||||
#include "EntitySelectedEvent.h"
|
#include "EntitySelectionChangedEvent.h"
|
||||||
#include "EventManager.h"
|
#include "EventManager.h"
|
||||||
#include "FacingComponent.h"
|
#include "FacingComponent.h"
|
||||||
#include "FactionComponent.h"
|
#include "FactionComponent.h"
|
||||||
@@ -266,7 +266,7 @@ void ArenaView::mousePressEvent(QMouseEvent* event)
|
|||||||
selection.push_back(*m_selectedEntity);
|
selection.push_back(*m_selectedEntity);
|
||||||
}
|
}
|
||||||
EventManager::getInstance()->sendEventImmediately(
|
EventManager::getInstance()->sendEventImmediately(
|
||||||
std::make_shared<EntitySelectedEvent>(selection));
|
std::make_shared<EntitySelectionChangedEvent>(selection));
|
||||||
}
|
}
|
||||||
|
|
||||||
QOpenGLWidget::mousePressEvent(event);
|
QOpenGLWidget::mousePressEvent(event);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include "BeamFiredEvent.h"
|
#include "BeamFiredEvent.h"
|
||||||
|
|
||||||
#include "entt/entity/entity.hpp"
|
#include "entt/entity/entity.hpp"
|
||||||
#include "EntitySelectedEvent.h"
|
#include "EntitySelectionChangedEvent.h"
|
||||||
#include "Tick.h"
|
#include "Tick.h"
|
||||||
#include "TickDriver.h"
|
#include "TickDriver.h"
|
||||||
#include "VisualsConfig.h"
|
#include "VisualsConfig.h"
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ void InspectWindow::updateInfoPanel(const ArenaStatus& status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectWindow::handleEvent(std::shared_ptr<const EntitySelectedEvent> event)
|
void InspectWindow::handleEvent(std::shared_ptr<const EntitySelectionChangedEvent> event)
|
||||||
{
|
{
|
||||||
if (!event->entities.empty())
|
if (!event->entities.empty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "entt/entity/entity.hpp"
|
#include "entt/entity/entity.hpp"
|
||||||
|
|
||||||
#include "ArenaSimulation.h"
|
#include "ArenaSimulation.h"
|
||||||
#include "EntitySelectedEvent.h"
|
#include "EntitySelectionChangedEvent.h"
|
||||||
#include "EventHandler.h"
|
#include "EventHandler.h"
|
||||||
#include "GameConfig.h"
|
#include "GameConfig.h"
|
||||||
#include "GameSpeedChangedEvent.h"
|
#include "GameSpeedChangedEvent.h"
|
||||||
@@ -22,7 +22,7 @@ class ArenaView;
|
|||||||
class ShipStatsPanel;
|
class ShipStatsPanel;
|
||||||
|
|
||||||
class InspectWindow : public QWidget,
|
class InspectWindow : public QWidget,
|
||||||
public CombinedEventHandler<EntitySelectedEvent,
|
public CombinedEventHandler<EntitySelectionChangedEvent,
|
||||||
GameSpeedChangedEvent>
|
GameSpeedChangedEvent>
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -38,7 +38,7 @@ protected:
|
|||||||
void keyPressEvent(QKeyEvent* event) override;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleEvent(std::shared_ptr<const EntitySelectedEvent> event) override;
|
void handleEvent(std::shared_ptr<const EntitySelectionChangedEvent> event) override;
|
||||||
void handleEvent(std::shared_ptr<const GameSpeedChangedEvent> event) override;
|
void handleEvent(std::shared_ptr<const GameSpeedChangedEvent> event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ SET(HDRS
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/TickAdvancedEvent.h
|
${CMAKE_CURRENT_SOURCE_DIR}/TickAdvancedEvent.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/BuildingBlocksChangedEvent.h
|
${CMAKE_CURRENT_SOURCE_DIR}/BuildingBlocksChangedEvent.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ExpansionCostChangedEvent.h
|
${CMAKE_CURRENT_SOURCE_DIR}/ExpansionCostChangedEvent.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/EntitySelectedEvent.h
|
${CMAKE_CURRENT_SOURCE_DIR}/EntitySelectionChangedEvent.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/GameSpeedChangedEvent.h
|
${CMAKE_CURRENT_SOURCE_DIR}/GameSpeedChangedEvent.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/BossWaveUpdatedEvent.h
|
${CMAKE_CURRENT_SOURCE_DIR}/BossWaveUpdatedEvent.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/SchematicChoicesAvailableEvent.h
|
${CMAKE_CURRENT_SOURCE_DIR}/SchematicChoicesAvailableEvent.h
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef ENTITY_SELECTED_EVENT_H
|
#ifndef ENTITY_SELECTION_CHANGED_EVENT_H
|
||||||
#define ENTITY_SELECTED_EVENT_H
|
#define ENTITY_SELECTION_CHANGED_EVENT_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -11,10 +11,10 @@
|
|||||||
// no actor is selected. Actors share the "field" selection category with scrap piles
|
// no actor is selected. Actors share the "field" selection category with scrap piles
|
||||||
// (REQ-UI-SELECTION-CATEGORIES): they can be selected together, but never together with
|
// (REQ-UI-SELECTION-CATEGORIES): they can be selected together, but never together with
|
||||||
// buildings.
|
// buildings.
|
||||||
class EntitySelectedEvent : public Event
|
class EntitySelectionChangedEvent : public Event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit EntitySelectedEvent(std::vector<entt::entity> entities)
|
explicit EntitySelectionChangedEvent(std::vector<entt::entity> entities)
|
||||||
: entities(std::move(entities))
|
: entities(std::move(entities))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -22,4 +22,4 @@ public:
|
|||||||
const std::vector<entt::entity> entities;
|
const std::vector<entt::entity> entities;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENTITY_SELECTED_EVENT_H
|
#endif // ENTITY_SELECTION_CHANGED_EVENT_H
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "ReplayRecorder.h"
|
#include "ReplayRecorder.h"
|
||||||
#include "DemolishModeChangedEvent.h"
|
#include "DemolishModeChangedEvent.h"
|
||||||
#include "EntityHitTest.h"
|
#include "EntityHitTest.h"
|
||||||
#include "EntitySelectedEvent.h"
|
#include "EntitySelectionChangedEvent.h"
|
||||||
#include "EventManager.h"
|
#include "EventManager.h"
|
||||||
#include "FacingComponent.h"
|
#include "FacingComponent.h"
|
||||||
#include "FactionComponent.h"
|
#include "FactionComponent.h"
|
||||||
@@ -731,7 +731,7 @@ void GameWorldView::clearEntitySelection()
|
|||||||
if (m_selectedEntities.empty()) { return; }
|
if (m_selectedEntities.empty()) { return; }
|
||||||
m_selectedEntities.clear();
|
m_selectedEntities.clear();
|
||||||
EventManager::getInstance()->sendEventImmediately(
|
EventManager::getInstance()->sendEventImmediately(
|
||||||
std::make_shared<EntitySelectedEvent>(m_selectedEntities));
|
std::make_shared<EntitySelectionChangedEvent>(m_selectedEntities));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameWorldView::pruneDespawnedActors()
|
void GameWorldView::pruneDespawnedActors()
|
||||||
@@ -753,7 +753,7 @@ void GameWorldView::pruneDespawnedActors()
|
|||||||
{
|
{
|
||||||
m_selectedEntities = std::move(live);
|
m_selectedEntities = std::move(live);
|
||||||
EventManager::getInstance()->sendEventImmediately(
|
EventManager::getInstance()->sendEventImmediately(
|
||||||
std::make_shared<EntitySelectedEvent>(m_selectedEntities));
|
std::make_shared<EntitySelectionChangedEvent>(m_selectedEntities));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2118,7 +2118,7 @@ void GameWorldView::mousePressEvent(QMouseEvent* event)
|
|||||||
clearScrapSelection();
|
clearScrapSelection();
|
||||||
}
|
}
|
||||||
EventManager::getInstance()->sendEventImmediately(
|
EventManager::getInstance()->sendEventImmediately(
|
||||||
std::make_shared<EntitySelectedEvent>(m_selectedEntities));
|
std::make_shared<EntitySelectionChangedEvent>(m_selectedEntities));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2308,7 +2308,7 @@ void GameWorldView::mouseReleaseEvent(QMouseEvent* event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EventManager::getInstance()->sendEventImmediately(
|
EventManager::getInstance()->sendEventImmediately(
|
||||||
std::make_shared<EntitySelectedEvent>(m_selectedEntities));
|
std::make_shared<EntitySelectionChangedEvent>(m_selectedEntities));
|
||||||
EventManager::getInstance()->sendEventImmediately(
|
EventManager::getInstance()->sendEventImmediately(
|
||||||
std::make_shared<ScrapSelectionChangedEvent>(m_selectedScrap));
|
std::make_shared<ScrapSelectionChangedEvent>(m_selectedScrap));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include "entt/entity/entity.hpp"
|
#include "entt/entity/entity.hpp"
|
||||||
#include "CommandManager.h"
|
#include "CommandManager.h"
|
||||||
#include "EntitySelectedEvent.h"
|
#include "EntitySelectionChangedEvent.h"
|
||||||
#include "GameConfig.h"
|
#include "GameConfig.h"
|
||||||
#include "Rotation.h"
|
#include "Rotation.h"
|
||||||
#include "Tick.h"
|
#include "Tick.h"
|
||||||
@@ -191,7 +191,7 @@ private:
|
|||||||
// Drops despawned or fully-collected piles from the scrap selection and re-emits
|
// Drops despawned or fully-collected piles from the scrap selection and re-emits
|
||||||
// when it changed (REQ-UI-SCRAP-CLICK-SELECT). Called each frame from onFrame().
|
// when it changed (REQ-UI-SCRAP-CLICK-SELECT). Called each frame from onFrame().
|
||||||
void pruneDespawnedScrap();
|
void pruneDespawnedScrap();
|
||||||
// Clears the actor selection, emitting an empty EntitySelectedEvent when it was
|
// Clears the actor selection, emitting an empty EntitySelectionChangedEvent when it was
|
||||||
// non-empty (REQ-UI-ENTITY-CLICK-SELECT). Used when buildings take over.
|
// non-empty (REQ-UI-ENTITY-CLICK-SELECT). Used when buildings take over.
|
||||||
void clearEntitySelection();
|
void clearEntitySelection();
|
||||||
// Drops despawned or dead actors from the selection and re-emits when it changed
|
// Drops despawned or dead actors from the selection and re-emits when it changed
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include "DisplayName.h"
|
#include "DisplayName.h"
|
||||||
#include "DynamicBodyComponent.h"
|
#include "DynamicBodyComponent.h"
|
||||||
#include "EntityAdmin.h"
|
#include "EntityAdmin.h"
|
||||||
#include "EntitySelectedEvent.h"
|
#include "EntitySelectionChangedEvent.h"
|
||||||
#include "EventManager.h"
|
#include "EventManager.h"
|
||||||
#include "FactionComponent.h"
|
#include "FactionComponent.h"
|
||||||
#include "HealthComponent.h"
|
#include "HealthComponent.h"
|
||||||
@@ -914,7 +914,7 @@ void SelectedBuildingPanel::onClearBelt()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectedBuildingPanel::handleEvent(std::shared_ptr<const EntitySelectedEvent> event)
|
void SelectedBuildingPanel::handleEvent(std::shared_ptr<const EntitySelectionChangedEvent> event)
|
||||||
{
|
{
|
||||||
m_selectedEntities = event->entities;
|
m_selectedEntities = event->entities;
|
||||||
if (!m_selectedEntities.empty())
|
if (!m_selectedEntities.empty())
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include "Building.h"
|
#include "Building.h"
|
||||||
#include "BuildingId.h"
|
#include "BuildingId.h"
|
||||||
#include "DebugDrawToggledEvent.h"
|
#include "DebugDrawToggledEvent.h"
|
||||||
#include "EntitySelectedEvent.h"
|
#include "EntitySelectionChangedEvent.h"
|
||||||
#include "EventHandler.h"
|
#include "EventHandler.h"
|
||||||
#include "GameConfig.h"
|
#include "GameConfig.h"
|
||||||
#include "PlayerCommandsAppliedEvent.h"
|
#include "PlayerCommandsAppliedEvent.h"
|
||||||
@@ -36,7 +36,7 @@ class QVBoxLayout;
|
|||||||
class SelectedBuildingPanel : public QWidget,
|
class SelectedBuildingPanel : public QWidget,
|
||||||
public CombinedEventHandler<TickAdvancedEvent,
|
public CombinedEventHandler<TickAdvancedEvent,
|
||||||
PlayerCommandsAppliedEvent,
|
PlayerCommandsAppliedEvent,
|
||||||
EntitySelectedEvent,
|
EntitySelectionChangedEvent,
|
||||||
SelectionChangedEvent,
|
SelectionChangedEvent,
|
||||||
ScrapSelectionChangedEvent,
|
ScrapSelectionChangedEvent,
|
||||||
DebugDrawToggledEvent>
|
DebugDrawToggledEvent>
|
||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void handleEvent(std::shared_ptr<const TickAdvancedEvent> event) override;
|
void handleEvent(std::shared_ptr<const TickAdvancedEvent> event) override;
|
||||||
void handleEvent(std::shared_ptr<const PlayerCommandsAppliedEvent> event) override;
|
void handleEvent(std::shared_ptr<const PlayerCommandsAppliedEvent> event) override;
|
||||||
void handleEvent(std::shared_ptr<const EntitySelectedEvent> event) override;
|
void handleEvent(std::shared_ptr<const EntitySelectionChangedEvent> event) override;
|
||||||
void handleEvent(std::shared_ptr<const SelectionChangedEvent> event) override;
|
void handleEvent(std::shared_ptr<const SelectionChangedEvent> event) override;
|
||||||
void handleEvent(std::shared_ptr<const ScrapSelectionChangedEvent> event) override;
|
void handleEvent(std::shared_ptr<const ScrapSelectionChangedEvent> event) override;
|
||||||
void handleEvent(std::shared_ptr<const DebugDrawToggledEvent> event) override;
|
void handleEvent(std::shared_ptr<const DebugDrawToggledEvent> event) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user