summaryrefslogtreecommitdiffhomepage
path: root/editor/editor.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-08-16 22:49:54 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-08-16 22:49:54 +0200
commit889870345539cc4dd0f098b976ba555916f17aff (patch)
tree28dbd15ec0f97b2beda2b0174c1ac19a8742b113 /editor/editor.cpp
parent125cb3c0feb94e51b830957fb44ccc709b6afa61 (diff)
editor: don't allow entities on top of one another
There are still workarounds for when this is actually desirable.
Diffstat (limited to 'editor/editor.cpp')
-rw-r--r--editor/editor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp
index 1b0611e1..a1de4b4f 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -110,7 +110,8 @@ void editor::on_click_(world& world, global_coords pos, button b)
default: break;
case button::place:
if (const auto& sel = mode->get_selected())
- mode->place_tile(world, pos, sel, *_app);
+ if (auto [ch, t] = world[pos]; ch.can_place_entity(sel.proto, pos.local()))
+ mode->place_tile(world, pos, sel, *_app);
break;
case button::remove:
mode->place_tile(world, pos, {}, *_app);