diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-27 16:50:12 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-27 16:50:12 +0100 |
commit | 0a7ab6ad108d4c1820975e05e1429bad708da662 (patch) | |
tree | 2daea2e35adbbe79f0f4f7783391b8869f2af9ee /serialize | |
parent | 1756ee2afde0659430f3a8f7e50a6734ce7519c7 (diff) |
add ephemeral object flag
Used to prevent objects from being stored in save files.
Diffstat (limited to 'serialize')
-rw-r--r-- | serialize/savegame.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/serialize/savegame.cpp b/serialize/savegame.cpp index 620d7457..eea89a03 100644 --- a/serialize/savegame.cpp +++ b/serialize/savegame.cpp @@ -490,11 +490,20 @@ ok: template<typename F> void serialize_objects_(chunk& c, F&& f) { - f((uint32_t)c.objects().size()); + uint32_t count = 0; + for (const std::shared_ptr<object>& obj : c.objects()) + { + if (obj->ephemeral) + continue; + count++; + } + f((uint32_t)count); for (const std::shared_ptr<object>& obj : c.objects()) { fm_assert(obj != nullptr); + if (obj->ephemeral) + continue; do_visit(object_magic, f); // todo move before all objects visit(*obj, f, c.coord()); } |