diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 1a58214527..86d352426f 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -838,7 +838,7 @@ public: WindowBase* Create( std::unique_ptr&& wp, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, - uint32_t flags) override + WindowFlags flags) override { height += wp->getTitleBarDiffTarget(); @@ -1070,7 +1070,7 @@ public: /** * Closes all windows, save for those having any of the passed flags. */ - void CloseAllExceptFlags(uint16_t flags) override + void CloseAllExceptFlags(WindowFlags flags) override { CloseByCondition([flags](WindowBase* w) -> bool { return !(w->flags & flags); }); } @@ -1347,7 +1347,7 @@ public: return &w; } - WindowBase* BringToFrontByClassWithFlags(WindowClass cls, uint16_t flags) override + WindowBase* BringToFrontByClassWithFlags(WindowClass cls, WindowFlags flags) override { WindowBase* w = FindByClass(cls); if (w != nullptr) diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index fae2c72762..752f5c3f8e 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -96,6 +96,7 @@ namespace OpenRCT2 WF_AUTO_POSITION = (1 << 16), WF_CENTRE_SCREEN = (1 << 17), }; + using WindowFlags = uint32_t; enum { diff --git a/src/openrct2/interface/WindowBase.h b/src/openrct2/interface/WindowBase.h index 02dd52acd4..8428fbcb19 100644 --- a/src/openrct2/interface/WindowBase.h +++ b/src/openrct2/interface/WindowBase.h @@ -88,7 +88,7 @@ namespace OpenRCT2 rct_windownumber number{}; RideId rideId; }; - uint16_t flags{}; + WindowFlags flags{}; OpenRCT2::ScrollArea scrolls[3]; uint16_t no_list_items{}; // 0 for no items int16_t selected_list_item{}; // -1 for none selected diff --git a/src/openrct2/ui/DummyWindowManager.cpp b/src/openrct2/ui/DummyWindowManager.cpp index c389e20dc2..40ba91309f 100644 --- a/src/openrct2/ui/DummyWindowManager.cpp +++ b/src/openrct2/ui/DummyWindowManager.cpp @@ -73,7 +73,7 @@ namespace OpenRCT2::Ui WindowBase* Create( std::unique_ptr&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, - uint32_t flags) override + WindowFlags flags) override { return nullptr; } @@ -86,7 +86,7 @@ namespace OpenRCT2::Ui void CloseTop() override {}; void CloseAll() override {}; void CloseAllExceptClass(WindowClass cls) override {}; - void CloseAllExceptFlags(uint16_t flags) override {}; + void CloseAllExceptFlags(WindowFlags flags) override {}; void CloseAllExceptNumberAndClass(rct_windownumber number, WindowClass cls) override {}; void CloseConstructionWindows() override {}; @@ -127,7 +127,7 @@ namespace OpenRCT2::Ui { return nullptr; } - WindowBase* BringToFrontByClassWithFlags(WindowClass cls, uint16_t flags) override + WindowBase* BringToFrontByClassWithFlags(WindowClass cls, WindowFlags flags) override { return nullptr; } diff --git a/src/openrct2/ui/WindowManager.h b/src/openrct2/ui/WindowManager.h index 99aadaee80..eb959f0c1b 100644 --- a/src/openrct2/ui/WindowManager.h +++ b/src/openrct2/ui/WindowManager.h @@ -44,26 +44,27 @@ namespace OpenRCT2::Ui virtual WindowBase* GetOwner(const Viewport* viewport) = 0; virtual WindowBase* Create( - std::unique_ptr&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags) + std::unique_ptr&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, + WindowFlags flags) = 0; template::value>::type* = nullptr> T* Create( - WindowClass cls, const ScreenCoordsXY& pos = {}, int32_t width = 0, int32_t height = 0, uint32_t flags = 0, + WindowClass cls, const ScreenCoordsXY& pos = {}, int32_t width = 0, int32_t height = 0, WindowFlags flags = 0, TArgs&&... args) { return static_cast(Create(std::make_unique(std::forward(args)...), cls, pos, width, height, flags)); } template::value>::type* = nullptr> - T* Create(WindowClass cls, int32_t width, int32_t height, uint32_t flags, TArgs&&... args) + T* Create(WindowClass cls, int32_t width, int32_t height, WindowFlags flags, TArgs&&... args) { return static_cast( Create(std::make_unique(std::forward(args)...), cls, {}, width, height, flags | WF_AUTO_POSITION)); } template::value>::type* = nullptr> - T* FocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, int32_t width, int32_t height, uint32_t flags = 0) + T* FocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, int32_t width, int32_t height, WindowFlags flags = 0) { auto* w = BringToFrontByClass(cls); if (w == nullptr) @@ -74,7 +75,7 @@ namespace OpenRCT2::Ui } template::value>::type* = nullptr> - T* FocusOrCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags = 0) + T* FocusOrCreate(WindowClass cls, int32_t width, int32_t height, WindowFlags flags = 0) { auto* w = BringToFrontByClass(cls); if (w == nullptr) @@ -92,7 +93,7 @@ namespace OpenRCT2::Ui virtual void CloseTop() = 0; virtual void CloseAll() = 0; virtual void CloseAllExceptClass(WindowClass cls) = 0; - virtual void CloseAllExceptFlags(uint16_t flags) = 0; + virtual void CloseAllExceptFlags(WindowFlags flags) = 0; virtual void CloseAllExceptNumberAndClass(rct_windownumber number, WindowClass cls) = 0; virtual void CloseConstructionWindows() = 0; @@ -112,7 +113,7 @@ namespace OpenRCT2::Ui virtual WindowBase* BringToFront(WindowBase& w) = 0; virtual WindowBase* BringToFrontByClass(WindowClass cls) = 0; - virtual WindowBase* BringToFrontByClassWithFlags(WindowClass cls, uint16_t flags) = 0; + virtual WindowBase* BringToFrontByClassWithFlags(WindowClass cls, WindowFlags flags) = 0; virtual WindowBase* BringToFrontByNumber(WindowClass cls, rct_windownumber number) = 0; };