summaryrefslogtreecommitdiffhomepage
path: root/src/scenery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/scenery.cpp')
-rw-r--r--src/scenery.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/scenery.cpp b/src/scenery.cpp
index 5fe6d573..be0249d2 100644
--- a/src/scenery.cpp
+++ b/src/scenery.cpp
@@ -85,9 +85,12 @@ bool scenery::activate(std::size_t)
return false;
}
-bool scenery::operator==(const entity_proto& e0) const
+bool scenery_proto::operator==(const entity_proto& e0) const
{
- if (!entity::operator==(e0))
+ if (type != e0.type)
+ return false;
+
+ if (!entity_proto::operator==(e0))
return false;
const auto& s0 = static_cast<const scenery_proto&>(e0);
@@ -95,6 +98,25 @@ bool scenery::operator==(const entity_proto& e0) const
closing == s0.closing && interactive == s0.interactive;
}
+scenery::operator scenery_proto() const
+{
+ scenery_proto ret;
+ ret.sc_type = sc_type;
+ ret.active = active;
+ ret.closing = closing;
+ ret.interactive = interactive;
+ ret.atlas = atlas;
+ ret.offset = offset;
+ ret.bbox_offset = bbox_offset;
+ ret.bbox_size = bbox_size;
+ ret.delta = delta;
+ ret.frame = frame;
+ ret.type = entity_type::character;
+ ret.r = r;
+ ret.pass = pass;
+ return ret;
+}
+
scenery::scenery(std::uint64_t id, struct chunk& c, entity_type type, const scenery_proto& proto) :
entity{id, c, type}, sc_type{proto.sc_type}, active{proto.active},
closing{proto.closing}, interactive{proto.interactive}