mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 11:33:03 +01:00
Add with(), without() methods to FlagHolder
This commit is contained in:
@@ -67,6 +67,22 @@ struct FlagHolder
|
||||
holder |= EnumsToFlags(types...);
|
||||
}
|
||||
|
||||
template<typename... TTypes>
|
||||
constexpr FlagHolder with(TTypes... types)
|
||||
{
|
||||
FlagHolder res = *this;
|
||||
res.set(types...);
|
||||
return res;
|
||||
}
|
||||
|
||||
template<typename... TTypes>
|
||||
constexpr FlagHolder without(TTypes... types)
|
||||
{
|
||||
FlagHolder res = *this;
|
||||
res.unset(types...);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* For situations where you don’t know upfront whether to set or unset the flag,
|
||||
* e.g. in game actions where this is passed as a variable.
|
||||
|
||||
Reference in New Issue
Block a user