1
0
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:
Gymnasiast
2025-10-16 21:04:27 +02:00
parent 7fd9743d22
commit ecc2e8b311

View File

@@ -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 dont know upfront whether to set or unset the flag,
* e.g. in game actions where this is passed as a variable.