From ccb8f3fbcd578140118f047ef91ab66983414ef1 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Wed, 13 Sep 2023 10:10:01 +0100 Subject: [PATCH] Add `AutomapTile#hasAnyFlag` For use in #6555 --- Source/automap.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/automap.cpp b/Source/automap.cpp index d0ae37036f7..8e6ff2ef5c2 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -16,6 +16,7 @@ #include "levels/gendung.h" #include "levels/setmaps.h" #include "player.h" +#include "utils/attributes.h" #include "utils/language.h" #include "utils/stdcompat/algorithm.hpp" #include "utils/ui_fwd.h" @@ -95,6 +96,14 @@ struct AutomapTile { { return (static_cast(flags) & static_cast(test)) != 0; } + + template + [[nodiscard]] DVL_ALWAYS_INLINE constexpr bool hasAnyFlag(Flags flag, Args... flags) + { + return (static_cast(this->flags) + & (static_cast(flag) | ... | static_cast(flags))) + != 0; + } }; /**