diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-14 18:38:38 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-14 18:38:38 +0100 |
commit | 317121940b6692de2bdc84b706e9c7d9de293a7a (patch) | |
tree | 62e0f0dbc39198cd01e92183be0a7eaf96d0df9f /src | |
parent | e2e2bb26cdd89eebb7b22269e9fac695b9c0ca23 (diff) |
a
Diffstat (limited to 'src')
-rw-r--r-- | src/chunk.hpp | 1 | ||||
-rw-r--r-- | src/world.cpp | 7 |
2 files changed, 8 insertions, 0 deletions
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(); |