From 055b027a3cf567fd8cfe19e1aad7a055f2449b86 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 29 Oct 2022 03:10:43 +0200 Subject: a --- src/tile-image.cpp | 11 +++++++++++ src/tile-image.hpp | 8 ++------ src/tile.cpp | 8 ++++++++ src/tile.hpp | 2 ++ 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 src/tile-image.cpp (limited to 'src') diff --git a/src/tile-image.cpp b/src/tile-image.cpp new file mode 100644 index 00000000..4210db94 --- /dev/null +++ b/src/tile-image.cpp @@ -0,0 +1,11 @@ +#include "tile-image.hpp" + +namespace floormat { + +bool operator==(const tile_image& a, const tile_image& b) noexcept +{ + return a.atlas == b.atlas && a.variant == b.variant; +} + +} // namespace floormat + diff --git a/src/tile-image.hpp b/src/tile-image.hpp index 06d0cb41..6c90a2d5 100644 --- a/src/tile-image.hpp +++ b/src/tile-image.hpp @@ -13,12 +13,8 @@ struct tile_image final std::uint16_t variant = (std::uint16_t)-1; explicit operator bool() const noexcept { return !!atlas; } - - std::strong_ordering operator<=>(const tile_image& o) const noexcept - { - const auto ret = atlas.get() <=> o.atlas.get(); - return ret != std::strong_ordering::equal ? ret : variant <=> o.variant; - } }; +bool operator==(const tile_image& a, const tile_image& b) noexcept; + } // namespace floormat diff --git a/src/tile.cpp b/src/tile.cpp index 82970c76..7e988a27 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -2,4 +2,12 @@ namespace floormat { +bool operator==(const tile& a, const tile& b) noexcept +{ + return a.ground == b.ground && + a.wall_north == b.wall_north && + a.wall_west == b.wall_west && + a.passability == b.passability; +} + } // namespace floormat diff --git a/src/tile.hpp b/src/tile.hpp index 1997f747..52d06b9d 100644 --- a/src/tile.hpp +++ b/src/tile.hpp @@ -17,4 +17,6 @@ struct tile final fm_DECLARE_DEFAULT_MOVE_ASSIGNMENT_(tile); }; +bool operator==(const tile& a, const tile& b) noexcept; + } //namespace floormat -- cgit v1.2.3