From 0a7ab6ad108d4c1820975e05e1429bad708da662 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 27 Feb 2024 16:50:12 +0100 Subject: add ephemeral object flag Used to prevent objects from being stored in save files. --- serialize/savegame.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'serialize') 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 void serialize_objects_(chunk& c, F&& f) { - f((uint32_t)c.objects().size()); + uint32_t count = 0; + for (const std::shared_ptr& obj : c.objects()) + { + if (obj->ephemeral) + continue; + count++; + } + f((uint32_t)count); for (const std::shared_ptr& 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()); } -- cgit v1.2.3