summaryrefslogtreecommitdiffhomepage
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
parent4a50e313d2f24334ecbea1dc86d7b506116774d1 (diff)
serialize: fix sc_exact condition
-rw-r--r--serialize/world-writer.cpp12
-rw-r--r--test/serializer.cpp1
2 files changed, 8 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);
diff --git a/test/serializer.cpp b/test/serializer.cpp
index 69b45575..3e1e6a97 100644
--- a/test/serializer.cpp
+++ b/test/serializer.cpp
@@ -30,6 +30,7 @@ chunk test_app::make_test_chunk()
c[{K+3, K+1}].scenery() = door;
c[{ 3, 4 }].scenery() = table;
c[{K, K+1}].scenery() = control_panel;
+ c[{K, K+1}].scenery().frame.bbox_size = {99, 88};
c.mark_modified();
return c;
}