summaryrefslogtreecommitdiffhomepage
path: root/serialize
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-02-27 00:06:01 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-02-27 00:06:01 +0100
commit916eb5ef147d218c519fcc31c696f2e121890dcd (patch)
treea7672883f2609a54e85bc9ce78c1d0cc56ee17d1 /serialize
parent4a50e313d2f24334ecbea1dc86d7b506116774d1 (diff)
serialize: fix sc_exact condition
Diffstat (limited to 'serialize')
-rw-r--r--serialize/world-writer.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/serialize/world-writer.cpp b/serialize/world-writer.cpp
index 170f4aa2..6bb033ab 100644
--- a/serialize/world-writer.cpp
+++ b/serialize/world-writer.cpp
@@ -10,6 +10,7 @@
#include "loader/loader.hpp"
#include "src/scenery.hpp"
#include "loader/scenery.hpp"
+#include "src/anim-atlas.hpp"
#include <vector>
#include <algorithm>
#include <cstring>
@@ -304,11 +305,12 @@ void writer_state::serialize_chunk(const chunk& c, chunk_coords coord)
auto img_w = maybe_intern_atlas(wall_west);
auto [sc, img_s, sc_exact] = maybe_intern_scenery(x.scenery(), true);
- constexpr struct scenery default_scenery;
-
- sc_exact &= scenery.offset == default_scenery.offset;
- sc_exact &= scenery.bbox_size == default_scenery.bbox_size;
- sc_exact &= scenery.bbox_offset == default_scenery.bbox_offset;
+ if (sc_exact && sc)
+ {
+ sc_exact = scenery.offset == sc->proto.frame.offset &&
+ scenery.bbox_size == sc->proto.frame.bbox_size &&
+ scenery.bbox_offset == sc->proto.frame.bbox_offset;
+ }
tilemeta flags = {};
flags |= meta_ground * (img_g != null_atlas);