summaryrefslogtreecommitdiffhomepage
path: root/src/scenery.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-17 07:01:45 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-17 23:23:11 +0100
commit34ae7b665919d05660263bf522c78ebdb735d30d (patch)
treed58a83c5b5b71763c71e51cf421079380cac00c1 /src/scenery.cpp
parent34a0239ad6e6d84bd0027d9029d0d74419247d01 (diff)
aaa
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}