From 317121940b6692de2bdc84b706e9c7d9de293a7a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 14 Mar 2023 18:38:38 +0100 Subject: a --- src/chunk.hpp | 1 + src/world.cpp | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/chunk.hpp b/src/chunk.hpp index a5eba19e..9f4e2ebd 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -31,6 +31,7 @@ struct chunk final { friend struct tile_ref; friend struct entity; + friend struct world; tile_ref operator[](std::size_t idx) noexcept; tile_proto operator[](std::size_t idx) const noexcept; diff --git a/src/world.cpp b/src/world.cpp index ea767422..f50853cf 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -11,6 +11,13 @@ world::world() : world{initial_capacity} world::~world() noexcept { _teardown = true; + for (auto& [k, v] : _chunks) + { + v._teardown = true; + v.mark_scenery_modified(true); + _last_chunk = {}; + v._entities.clear(); + } _last_chunk = {}; _chunks.clear(); _entities.clear(); -- cgit v1.2.3