From 73abf154e82546256f4a860c666f1f652767bda9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 15 Mar 2023 15:55:50 +0100 Subject: aa --- main/main-impl.cpp | 6 +++++- main/main-impl.hpp | 2 ++ main/setup.cpp | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'main') diff --git a/main/main-impl.cpp b/main/main-impl.cpp index ba2fa3ec..a971edcf 100644 --- a/main/main-impl.cpp +++ b/main/main-impl.cpp @@ -8,7 +8,11 @@ namespace floormat { floormat_main::floormat_main() noexcept = default; floormat_main::~floormat_main() noexcept = default; -main_impl::~main_impl() noexcept = default; + +main_impl::~main_impl() noexcept +{ + reset_world(); +} void main_impl::quit(int status) { Platform::Sdl2Application::exit(status); } struct world& main_impl::world() noexcept { return _world; } diff --git a/main/main-impl.hpp b/main/main-impl.hpp index ca3e9ad3..ddb16e81 100644 --- a/main/main-impl.hpp +++ b/main/main-impl.hpp @@ -33,6 +33,8 @@ struct main_impl final : Platform::Sdl2Application, floormat_main const tile_shader& shader() const noexcept override; struct world& world() noexcept override; + struct world& reset_world() noexcept override; + struct world& reset_world(struct world) noexcept override; SDL_Window* window() noexcept override; fm_settings& settings() noexcept override; diff --git a/main/setup.cpp b/main/setup.cpp index 8e0e36b9..1f0adcb4 100644 --- a/main/setup.cpp +++ b/main/setup.cpp @@ -98,4 +98,16 @@ auto main_impl::meshes() noexcept -> struct meshes return { _floor_mesh, _wall_mesh, _anim_mesh, }; }; +struct world& main_impl::reset_world() noexcept +{ + return reset_world(floormat::world{}); +} + +struct world& main_impl::reset_world(struct world w) noexcept +{ + _clickable_scenery.clear(); + _world = std::move(w); + return _world; +} + } // namespace floormat -- cgit v1.2.3