diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hole.cpp | 13 | ||||
-rw-r--r-- | src/hole.hpp | 4 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/hole.cpp b/src/hole.cpp index fa4a80d6..6a48e57b 100644 --- a/src/hole.cpp +++ b/src/hole.cpp @@ -18,7 +18,18 @@ hole_proto::hole_proto(hole_proto&&) noexcept = default; hole_proto& hole_proto::operator=(hole_proto&&) noexcept = default; bool hole_proto::flags::operator==(const struct flags&) const = default; -bool hole_proto::operator==(const hole_proto&) const = default; + +bool hole_proto::operator==(const object_proto& oʹ) const +{ + if (type != oʹ.type) + return false; + + if (!object_proto::operator==(oʹ)) + return false; + + const auto& o = static_cast<const hole_proto&>(oʹ); + return height == o.height && z_offset == o.z_offset && flags == o.flags; +} hole_proto::hole_proto() { diff --git a/src/hole.hpp b/src/hole.hpp index 49d1e809..6ec1c666 100644 --- a/src/hole.hpp +++ b/src/hole.hpp @@ -12,7 +12,7 @@ struct hole_proto final : object_proto hole_proto& operator=(const hole_proto&); hole_proto(hole_proto&&) noexcept; hole_proto& operator=(hole_proto&&) noexcept; - bool operator==(const hole_proto&) const; + bool operator==(const object_proto& proto) const override; struct flags { @@ -23,7 +23,7 @@ struct hole_proto final : object_proto bool is_wall : 1 = false; }; - uint8_t height = 0; + uint8_t height = 0, z_offset = tile_size_z/2; struct flags flags; }; |