summaryrefslogtreecommitdiff
path: root/kurator/src/inspect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kurator/src/inspect.cpp')
-rw-r--r--kurator/src/inspect.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/kurator/src/inspect.cpp b/kurator/src/inspect.cpp
index 4795068..062630c 100644
--- a/kurator/src/inspect.cpp
+++ b/kurator/src/inspect.cpp
@@ -43,11 +43,11 @@ InspectionWindow::show()
if (ImGui::Begin("Inspect", &open)) {
auto it = selected.begin();
while (it != selected.end()) {
- ImGui::PushID(it - selected.begin());
if (!it->valid()) {
it = selected.erase(it);
continue;
}
+ ImGui::PushID(it - selected.begin());
inspect<universe::UniqueIdentifier>(*it);
inspect<universe::ShipType>(*it);
inspect<universe::TurretType>(*it);
@@ -90,6 +90,8 @@ void
InspectionWindow::deselect()
{
for (auto&& entity_ : selected) {
+ if (!entity_.valid())
+ continue;
if (entity_.all_of<Marker>())
entity_.get<Marker>().selected = false;
if (entity_.all_of<TurretVisuals>())
@@ -154,12 +156,13 @@ inspect(entt::handle&, TurretVisuals& visuals)
static Color OPTIMAL {0x88, 0x22, 0x22, 0xff};
static Color EFFECTIVE {0x77, 0x50, 0x22, 0xff};
+
void
draw_turret_visuals(const sim::State& ctx)
{
const auto helpers = ctx.registry.view<TurretVisuals, universe::TurretType, sim::TurretControl>();
for (const auto& [entity, visuals, type, turret] : helpers.each()) {
- if (!visuals.visible)
+ if (!visuals.visible || !ctx.registry.valid(turret.owner))
continue;
const auto& transform = ctx.registry.get<sim::Transform>(turret.owner);
const auto center = ctx.camera.to_screen(transform.position);