From 90b214c0a4b3c91ad021c9923f1b8a69ccbe88e8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 30 Nov 2022 13:45:28 +0100 Subject: src: add missing scenery check in tile_ref::operator== --- src/scenery.cpp | 9 +++++++++ src/scenery.hpp | 2 ++ src/tile.cpp | 9 +++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/scenery.cpp b/src/scenery.cpp index 5f82e151..23967af8 100644 --- a/src/scenery.cpp +++ b/src/scenery.cpp @@ -108,4 +108,13 @@ bool scenery::activate(const anim_atlas& atlas) return false; } +#ifdef __GNUG__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfloat-equal" +#endif +bool scenery::operator==(const scenery&) const noexcept = default; +#ifdef __GNUG__ +#pragma GCC diagnostic pop +#endif + } // namespace floormat diff --git a/src/scenery.hpp b/src/scenery.hpp index 5f755bfd..05a72b43 100644 --- a/src/scenery.hpp +++ b/src/scenery.hpp @@ -45,6 +45,8 @@ struct scenery final bool passable = false, bool blocks_view = false, bool active = false, bool interactive = false); scenery(door_tag_t, const anim_atlas& atlas, rotation r, bool is_open = false); + bool operator==(const scenery&) const noexcept; + bool can_activate() const noexcept; bool activate(const anim_atlas& atlas); void update(float dt, const anim_atlas& anim); diff --git a/src/tile.cpp b/src/tile.cpp index 5f003258..56ac5746 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -80,10 +80,11 @@ bool operator==(const tile_ref& a, const tile_ref& b) noexcept if (a._chunk == b._chunk && a.i == b.i) return true; else - return a.ground() == b.ground() && - a.wall_north() == b.wall_north() && - a.wall_west() == b.wall_west() && - a.pass_mode() == b.pass_mode(); + return a.ground() == b.ground() && + a.wall_north() == b.wall_north() && + a.wall_west() == b.wall_west() && + a.scenery() == b.scenery() && + a.pass_mode() == b.pass_mode(); } } // namespace floormat -- cgit v1.2.3