From ecc2e8b311a99b1a0ba6e76ed1f5f4635d7ae559 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Thu, 16 Oct 2025 21:04:27 +0200 Subject: [PATCH] Add with(), without() methods to FlagHolder --- src/openrct2/core/FlagHolder.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/openrct2/core/FlagHolder.hpp b/src/openrct2/core/FlagHolder.hpp index b8d443c970..a63ac37620 100644 --- a/src/openrct2/core/FlagHolder.hpp +++ b/src/openrct2/core/FlagHolder.hpp @@ -67,6 +67,22 @@ struct FlagHolder holder |= EnumsToFlags(types...); } + template + constexpr FlagHolder with(TTypes... types) + { + FlagHolder res = *this; + res.set(types...); + return res; + } + + template + 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.