diff options
Diffstat (limited to 'editor/vobj-editor.cpp')
| -rw-r--r-- | editor/vobj-editor.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/editor/vobj-editor.cpp b/editor/vobj-editor.cpp index 6dc8c907..7e7dde15 100644 --- a/editor/vobj-editor.cpp +++ b/editor/vobj-editor.cpp @@ -48,18 +48,20 @@ void vobj_editor::place_tile(world& w, global_coords pos, const vobj_* x, struct if (!x) { auto [c, t] = w[pos]; +start: const auto& es = c.objects(); -start: while (auto id = a.get_object_colliding_with_cursor()) + while (auto id = a.get_object_colliding_with_cursor()) { for (auto i = (int)(es.size()-1); i >= 0; i--) { - const auto eʹ = es[i]; - if (eʹ->id == id && eʹ->is_virtual()) + auto eʹ = es[i]; + auto& e = *eʹ; + if (e.id == id && eʹ->is_virtual()) { - eʹ->destroy_script_pre(eʹ, script_destroy_reason::kill); + e.destroy_script_pre(eʹ, script_destroy_reason::kill); c.remove_object((unsigned)i); - eʹ->destroy_script_post(); - eʹ->gone = true; + e.destroy_script_post(); + eʹ.destroy(); goto start; } } |
