summaryrefslogtreecommitdiffhomepage
path: root/serialize
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-27 16:50:12 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-27 16:50:12 +0100
commit0a7ab6ad108d4c1820975e05e1429bad708da662 (patch)
tree2daea2e35adbbe79f0f4f7783391b8869f2af9ee /serialize
parent1756ee2afde0659430f3a8f7e50a6734ce7519c7 (diff)
add ephemeral object flag
Used to prevent objects from being stored in save files.
Diffstat (limited to 'serialize')
-rw-r--r--serialize/savegame.cpp11
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());
}