Skip to content

Commit

Permalink
Add AutomapTile#hasAnyFlag
Browse files Browse the repository at this point in the history
For use in diasurgical#6555
  • Loading branch information
glebm authored and wkdgmr committed Oct 2, 2023
1 parent b119940 commit ccb8f3f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Source/automap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -95,6 +96,14 @@ struct AutomapTile {
{
return (static_cast<uint8_t>(flags) & static_cast<uint8_t>(test)) != 0;
}

template <typename... Args>
[[nodiscard]] DVL_ALWAYS_INLINE constexpr bool hasAnyFlag(Flags flag, Args... flags)
{
return (static_cast<uint8_t>(this->flags)
& (static_cast<uint8_t>(flag) | ... | static_cast<uint8_t>(flags)))
!= 0;
}
};

/**
Expand Down

0 comments on commit ccb8f3f

Please sign in to comment.