summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-04-09 18:30:44 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-04-09 18:32:15 +0200
commit25749f7d527a1545b81f23cc461e6f6fbcb362aa (patch)
tree679d1c54c969566d801f008992bbc67b9435f1a3
parentaa49d7678b304d3db17f3b51107fcbcfa6dc3ee2 (diff)
editor: fix activating non-interactive entities
-rw-r--r--editor/update.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/update.cpp b/editor/update.cpp
index 41e5fde4..630d1397 100644
--- a/editor/update.cpp
+++ b/editor/update.cpp
@@ -68,7 +68,11 @@ void app::do_mouse_up_down(uint8_t button, bool is_down, int mods)
if (button == mouse_button_left)
{
if (auto* cl = find_clickable_scenery(*cursor.pixel))
- return (void)cl->e->activate(cl->e->index());
+ {
+ auto& e = *cl->e;
+ const auto i = e.index();
+ return e.can_activate(i) ? (void)e.activate(i) : void();
+ }
}
// TODO it should open on mouseup if still on the same item as on mousedown
else if (button == mouse_button_right)