mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
Move WindowCreate and WindowFocusOrCreate into WindowManager (#23643)
* Move WindowBringToFront into WindowManager * Move WindowCreate and WindowFocusOrCreate into WindowManager * Cut back on Context/UiContext includes
This commit is contained in:
parent
66ede938f8
commit
bed4d5bdca
113 changed files with 895 additions and 767 deletions
|
@ -30,7 +30,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
FootpathRemoveProvisionalTemporarily();
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::RideConstruction) != nullptr)
|
||||
{
|
||||
RideRemoveProvisionalTrackPiece();
|
||||
|
@ -50,7 +50,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
FootpathRestoreProvisional();
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::RideConstruction) != nullptr)
|
||||
{
|
||||
RideRestoreProvisionalTrackPiece();
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#include <openrct2-ui/input/MouseInput.h>
|
||||
#include <openrct2-ui/input/ShortcutManager.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/core/Console.hpp>
|
||||
#include <openrct2/core/Guard.hpp>
|
||||
|
@ -30,6 +32,7 @@
|
|||
#include <openrct2/ride/Ride.h>
|
||||
#include <openrct2/ride/RideConstruction.h>
|
||||
#include <openrct2/ride/Vehicle.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
@ -323,7 +326,7 @@ public:
|
|||
case INTENT_ACTION_NEW_SCENERY:
|
||||
{
|
||||
// Check if window is already open
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::Scenery);
|
||||
auto* window = BringToFrontByClass(WindowClass::Scenery);
|
||||
if (window == nullptr)
|
||||
ToggleSceneryWindow();
|
||||
|
||||
|
@ -647,6 +650,270 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static bool WindowFitsBetweenOthers(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
if (loc.x + width <= w->windowPos.x)
|
||||
continue;
|
||||
if (loc.x >= w->windowPos.x + w->width)
|
||||
continue;
|
||||
if (loc.y + height <= w->windowPos.y)
|
||||
continue;
|
||||
if (loc.y >= w->windowPos.y + w->height)
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool WindowFitsWithinSpace(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
if (loc.x < 0)
|
||||
return false;
|
||||
if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
return false;
|
||||
if (loc.x + width > ContextGetWidth())
|
||||
return false;
|
||||
if (loc.y + height > ContextGetHeight())
|
||||
return false;
|
||||
return WindowFitsBetweenOthers(loc, width, height);
|
||||
}
|
||||
|
||||
static bool WindowFitsOnScreen(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
uint16_t screenWidth = ContextGetWidth();
|
||||
uint16_t screenHeight = ContextGetHeight();
|
||||
int32_t unk;
|
||||
|
||||
unk = -(width / 4);
|
||||
if (loc.x < unk)
|
||||
return false;
|
||||
unk = screenWidth + (unk * 2);
|
||||
if (loc.x > unk)
|
||||
return false;
|
||||
if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
return false;
|
||||
unk = screenHeight - (height / 4);
|
||||
if (loc.y > unk)
|
||||
return false;
|
||||
return WindowFitsBetweenOthers(loc, width, height);
|
||||
}
|
||||
|
||||
static ScreenCoordsXY ClampWindowToScreen(
|
||||
const ScreenCoordsXY& pos, const int32_t screenWidth, const int32_t screenHeight, const int32_t width,
|
||||
const int32_t height)
|
||||
{
|
||||
auto screenPos = pos;
|
||||
if (width > screenWidth || screenPos.x < 0)
|
||||
screenPos.x = 0;
|
||||
else if (screenPos.x + width > screenWidth)
|
||||
screenPos.x = screenWidth - width;
|
||||
|
||||
auto toolbarAllowance = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) ? 0 : (kTopToolbarHeight + 1);
|
||||
if (height - toolbarAllowance > screenHeight || screenPos.y < toolbarAllowance)
|
||||
screenPos.y = toolbarAllowance;
|
||||
else if (screenPos.y + height - toolbarAllowance > screenHeight)
|
||||
screenPos.y = screenHeight + toolbarAllowance - height;
|
||||
|
||||
return screenPos;
|
||||
}
|
||||
|
||||
static ScreenCoordsXY GetAutoPositionForNewWindow(int32_t width, int32_t height)
|
||||
{
|
||||
auto uiContext = GetContext()->GetUiContext();
|
||||
auto screenWidth = uiContext->GetWidth();
|
||||
auto screenHeight = uiContext->GetHeight();
|
||||
|
||||
// Place window in an empty corner of the screen
|
||||
const ScreenCoordsXY cornerPositions[] = {
|
||||
{ 0, 30 }, // topLeft
|
||||
{ screenWidth - width, 30 }, // topRight
|
||||
{ 0, screenHeight - 34 - height }, // bottomLeft
|
||||
{ screenWidth - width, screenHeight - 34 - height }, // bottomRight
|
||||
};
|
||||
|
||||
for (const auto& cornerPos : cornerPositions)
|
||||
{
|
||||
if (WindowFitsWithinSpace(cornerPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(cornerPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
// Place window next to another
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
const ScreenCoordsXY offsets[] = {
|
||||
{ w->width + 2, 0 },
|
||||
{ -w->width - 2, 0 },
|
||||
{ 0, w->height + 2 },
|
||||
{ 0, -w->height - 2 },
|
||||
{ w->width + 2, -w->height - 2 },
|
||||
{ -w->width - 2, -w->height - 2 },
|
||||
{ w->width + 2, w->height + 2 },
|
||||
{ -w->width - 2, w->height + 2 },
|
||||
};
|
||||
|
||||
for (const auto& offset : offsets)
|
||||
{
|
||||
auto screenPos = w->windowPos + offset;
|
||||
if (WindowFitsWithinSpace(screenPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Overlap
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
const ScreenCoordsXY offsets[] = {
|
||||
{ w->width + 2, 0 },
|
||||
{ -w->width - 2, 0 },
|
||||
{ 0, w->height + 2 },
|
||||
{ 0, -w->height - 2 },
|
||||
};
|
||||
|
||||
for (const auto& offset : offsets)
|
||||
{
|
||||
auto screenPos = w->windowPos + offset;
|
||||
if (WindowFitsOnScreen(screenPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cascade
|
||||
auto screenPos = ScreenCoordsXY{ 0, 30 };
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (screenPos == w->windowPos)
|
||||
{
|
||||
screenPos.x += 5;
|
||||
screenPos.y += 5;
|
||||
}
|
||||
}
|
||||
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
|
||||
static ScreenCoordsXY GetCentrePositionForNewWindow(int32_t width, int32_t height)
|
||||
{
|
||||
auto uiContext = GetContext()->GetUiContext();
|
||||
auto screenWidth = uiContext->GetWidth();
|
||||
auto screenHeight = uiContext->GetHeight();
|
||||
return ScreenCoordsXY{ (screenWidth - width) / 2, std::max(kTopToolbarHeight + 1, (screenHeight - height) / 2) };
|
||||
}
|
||||
|
||||
WindowBase* Create(
|
||||
std::unique_ptr<WindowBase>&& wp, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height,
|
||||
uint32_t flags) override
|
||||
{
|
||||
if (flags & WF_AUTO_POSITION)
|
||||
{
|
||||
if (flags & WF_CENTRE_SCREEN)
|
||||
{
|
||||
pos = GetCentrePositionForNewWindow(width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = GetAutoPositionForNewWindow(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there are any window slots left
|
||||
// include kWindowLimitReserved for items such as the main viewport and toolbars to not appear to be counted.
|
||||
if (g_window_list.size() >= static_cast<size_t>(Config::Get().general.WindowLimit + kWindowLimitReserved))
|
||||
{
|
||||
// Close least recently used window
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE)))
|
||||
{
|
||||
WindowClose(*w.get());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find right position to insert new window
|
||||
auto itDestPos = g_window_list.end();
|
||||
if (flags & WF_STICK_TO_BACK)
|
||||
{
|
||||
for (auto it = g_window_list.begin(); it != g_window_list.end(); it++)
|
||||
{
|
||||
if ((*it)->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!((*it)->flags & WF_STICK_TO_BACK))
|
||||
{
|
||||
itDestPos = it;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
{
|
||||
if ((*it)->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!((*it)->flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
itDestPos = it.base();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto itNew = g_window_list.insert(itDestPos, std::move(wp));
|
||||
auto w = itNew->get();
|
||||
|
||||
// Setup window
|
||||
w->classification = cls;
|
||||
w->flags = flags;
|
||||
|
||||
// Play sounds and flash the window
|
||||
if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
|
||||
{
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 0, pos.x + (width / 2));
|
||||
}
|
||||
|
||||
w->windowPos = pos;
|
||||
w->width = width;
|
||||
w->height = height;
|
||||
w->min_width = width;
|
||||
w->max_width = width;
|
||||
w->min_height = height;
|
||||
w->max_height = height;
|
||||
|
||||
w->focus = std::nullopt;
|
||||
|
||||
ColourSchemeUpdate(w);
|
||||
w->Invalidate();
|
||||
w->OnOpen();
|
||||
return w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the first window with the specified window class.
|
||||
* rct2: 0x006EA8A0
|
||||
|
@ -762,6 +1029,82 @@ public:
|
|||
// Return the widget index
|
||||
return widget_index;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ECDA4
|
||||
*/
|
||||
WindowBase* BringToFront(WindowBase& w) override
|
||||
{
|
||||
if (!(w.flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
|
||||
{
|
||||
auto itSourcePos = WindowGetIterator(&w);
|
||||
if (itSourcePos != g_window_list.end())
|
||||
{
|
||||
// Insert in front of the first non-stick-to-front window
|
||||
auto itDestPos = g_window_list.begin();
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
{
|
||||
auto& w2 = *it;
|
||||
if (!(w2->flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
itDestPos = it.base();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_window_list.splice(itDestPos, g_window_list, itSourcePos);
|
||||
w.Invalidate();
|
||||
|
||||
if (w.windowPos.x + w.width < 20)
|
||||
{
|
||||
int32_t i = 20 - w.windowPos.x;
|
||||
w.windowPos.x += i;
|
||||
if (w.viewport != nullptr)
|
||||
w.viewport->pos.x += i;
|
||||
w.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
return &w;
|
||||
}
|
||||
|
||||
WindowBase* BringToFrontByClassWithFlags(WindowClass cls, uint16_t flags) override
|
||||
{
|
||||
WindowBase* w = FindByClass(cls);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->flags |= flags;
|
||||
w->Invalidate();
|
||||
w = BringToFront(*w);
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
WindowBase* BringToFrontByClass(WindowClass cls) override
|
||||
{
|
||||
return BringToFrontByClassWithFlags(cls, WF_WHITE_BORDER_MASK);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ED78A
|
||||
* cls (cl)
|
||||
* number (dx)
|
||||
*/
|
||||
WindowBase* BringToFrontByNumber(WindowClass cls, rct_windownumber number) override
|
||||
{
|
||||
WindowBase* w = FindByNumber(cls, number);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
w->Invalidate();
|
||||
w = BringToFront(*w);
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<IWindowManager> OpenRCT2::Ui::CreateWindowManager()
|
||||
|
|
|
@ -210,7 +210,7 @@ void InputManager::Process(const InputEvent& e)
|
|||
|
||||
if (e.DeviceKind == InputDeviceKind::Keyboard)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
// TODO: replace with event
|
||||
auto w = windowMgr->FindByClass(WindowClass::Textinput);
|
||||
|
@ -424,7 +424,7 @@ bool InputManager::HasTextInputFocus() const
|
|||
if (OpenRCT2::Ui::Windows::IsUsingWidgetTextBox() || gChatOpen)
|
||||
return true;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->FindByClass(WindowClass::Textinput);
|
||||
if (w != nullptr)
|
||||
return true;
|
||||
|
|
|
@ -246,7 +246,7 @@ namespace OpenRCT2
|
|||
*/
|
||||
static void InputScrollRight(const ScreenCoordsXY& screenCoords, MouseState state)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
|
||||
if (w == nullptr)
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ namespace OpenRCT2
|
|||
Widget* widget;
|
||||
WidgetIndex widgetIndex;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
// Get window and widget under cursor position
|
||||
w = windowMgr->FindFromPoint(screenCoords);
|
||||
|
@ -312,7 +312,7 @@ namespace OpenRCT2
|
|||
|
||||
if (w != nullptr)
|
||||
{
|
||||
w = WindowBringToFront(*w);
|
||||
w = windowMgr->BringToFront(*w);
|
||||
}
|
||||
|
||||
if (widgetIndex != kWidgetIndexNull)
|
||||
|
@ -566,7 +566,7 @@ namespace OpenRCT2
|
|||
if (differentialCoords.x == 0 && differentialCoords.y == 0)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
|
||||
|
||||
// #3294: Window can be closed during a drag session, so just finish
|
||||
|
@ -776,7 +776,7 @@ namespace OpenRCT2
|
|||
const auto& widget = w.widgets[widgetIndex];
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
int32_t newLeft;
|
||||
|
@ -816,7 +816,7 @@ namespace OpenRCT2
|
|||
const auto& widget = w.widgets[widgetIndex];
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
int32_t newTop;
|
||||
|
@ -853,7 +853,7 @@ namespace OpenRCT2
|
|||
*/
|
||||
static void InputScrollPartUpdateHLeft(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
@ -873,7 +873,7 @@ namespace OpenRCT2
|
|||
{
|
||||
const auto& widget = w.widgets[widgetIndex];
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
@ -899,7 +899,7 @@ namespace OpenRCT2
|
|||
*/
|
||||
static void InputScrollPartUpdateVTop(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
@ -919,7 +919,7 @@ namespace OpenRCT2
|
|||
{
|
||||
const auto& widget = w.widgets[widgetIndex];
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
@ -1016,7 +1016,7 @@ namespace OpenRCT2
|
|||
*/
|
||||
static void InputWidgetOverFlatbuttonInvalidate()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(gHoverWidget.window_classification, gHoverWidget.window_number);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1048,12 +1048,12 @@ namespace OpenRCT2
|
|||
WindowCloseByClass(WindowClass::Tooltip);
|
||||
|
||||
// Window might have changed position in the list, therefore find it again
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
w = windowMgr->FindByNumber(windowClass, windowNumber);
|
||||
if (w == nullptr)
|
||||
return;
|
||||
|
||||
w = WindowBringToFront(*w);
|
||||
w = windowMgr->BringToFront(*w);
|
||||
if (widgetIndex == kWidgetIndexNull)
|
||||
return;
|
||||
|
||||
|
@ -1145,7 +1145,7 @@ namespace OpenRCT2
|
|||
ft.Add<StringId>(STR_NONE);
|
||||
SetMapTooltip(ft);
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
|
||||
|
||||
if (window != nullptr)
|
||||
|
@ -1223,7 +1223,7 @@ namespace OpenRCT2
|
|||
{
|
||||
if (_inputFlags & INPUT_FLAG_TOOL_ACTIVE)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
|
||||
|
||||
if (w == nullptr)
|
||||
|
@ -1305,7 +1305,7 @@ namespace OpenRCT2
|
|||
cursor_w_number = gPressedWidget.window_number;
|
||||
WidgetIndex cursor_widgetIndex = gPressedWidget.widget_index;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* cursor_w = windowMgr->FindByNumber(cursor_w_class, cursor_w_number);
|
||||
if (cursor_w == nullptr)
|
||||
{
|
||||
|
@ -1612,7 +1612,7 @@ namespace OpenRCT2
|
|||
*/
|
||||
void InvalidateScroll()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(gPressedWidget.window_classification, gPressedWidget.window_number);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ static void ShortcutRotateConstructionObject()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
// Rotate scenery
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Scenery);
|
||||
|
@ -152,7 +152,7 @@ static void ShortcutRotateConstructionObject()
|
|||
|
||||
static void ShortcutRemoveTopBottomToolbarToggle()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
{
|
||||
|
@ -372,7 +372,7 @@ static void ShortcutOpenCheatWindow()
|
|||
return;
|
||||
|
||||
// Check if window is already open
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Cheats);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -441,7 +441,7 @@ static void ShortcutOpenSceneryPicker()
|
|||
|| (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && GetGameState().EditorStep != EditorStep::LandscapeEditor))
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window_scenery = windowMgr->FindByClass(WindowClass::Scenery);
|
||||
if (window_scenery == nullptr)
|
||||
ToggleSceneryWindow();
|
||||
|
@ -477,7 +477,7 @@ static void ShortcutScaleDown()
|
|||
// Tile inspector shortcuts
|
||||
static void TileInspectorMouseUp(WidgetIndex widgetIndex)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty)
|
||||
{
|
||||
|
@ -487,7 +487,7 @@ static void TileInspectorMouseUp(WidgetIndex widgetIndex)
|
|||
|
||||
static void TileInspectorMouseDown(WidgetIndex widgetIndex)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty)
|
||||
{
|
||||
|
@ -497,7 +497,7 @@ static void TileInspectorMouseDown(WidgetIndex widgetIndex)
|
|||
|
||||
static void ShortcutToggleWallSlope()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (window == nullptr)
|
||||
{
|
||||
|
@ -529,7 +529,7 @@ static void ShortcutToggleWallSlope()
|
|||
|
||||
static void ShortcutIncreaseElementHeight()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -569,7 +569,7 @@ static void ShortcutIncreaseElementHeight()
|
|||
|
||||
static void ShortcutDecreaseElementHeight()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -633,7 +633,7 @@ static void ShortcutConstructionTurnLeft()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -650,7 +650,7 @@ static void ShortcutConstructionTurnRight()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -667,7 +667,7 @@ static void ShortcutConstructionSlopeUp()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -684,7 +684,7 @@ static void ShortcutConstructionBuildCurrent()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -701,7 +701,7 @@ static void ShortcutConstructionSlopeDown()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -718,7 +718,7 @@ static void ShortcutConstructionDemolishCurrent()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -763,7 +763,7 @@ void ShortcutManager::RegisterDefaultShortcuts()
|
|||
RegisterShortcut(ShortcutId::kInterfaceCancelConstruction, STR_SHORTCUT_CANCEL_CONSTRUCTION_MODE, "ESCAPE", []() {
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = windowMgr->FindByClass(WindowClass::Error);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -900,7 +900,7 @@ void ShortcutManager::RegisterDefaultShortcuts()
|
|||
RegisterShortcut(ShortcutId::kDebugTogglePaintDebugWindow, STR_SHORTCUT_DEBUG_PAINT_TOGGLE, []() {
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = windowMgr->FindByClass(WindowClass::DebugPaint);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
|
|
@ -469,7 +469,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
if (!(InputTestFlag(INPUT_FLAG_6)) || !(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)))
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::RideConstruction) == nullptr
|
||||
&& windowMgr->FindByClass(WindowClass::Footpath) == nullptr)
|
||||
{
|
||||
|
@ -637,7 +637,7 @@ namespace OpenRCT2::Ui
|
|||
*/
|
||||
static void ViewportInteractionRemoveFootpath(const PathElement& pathElement, const CoordsXY& mapCoords)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
FootpathUpdateProvisional();
|
||||
|
@ -765,7 +765,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
static Peep* ViewportInteractionGetClosestPeep(ScreenCoordsXY screenCoords, int32_t maxDistance)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FindFromPoint(screenCoords);
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
|
@ -790,7 +790,7 @@ namespace OpenRCT2::Ui
|
|||
*/
|
||||
CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoords)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
|
||||
if (window == nullptr || window->viewport == nullptr)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenRCT2::Ui
|
|||
*/
|
||||
CoordsXY FootpathGetCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32_t* direction, TileElement** tileElement)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
|
||||
if (window == nullptr || window->viewport == nullptr)
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ namespace OpenRCT2::Ui
|
|||
CoordsXY FootpathBridgeGetInfoFromPos(const ScreenCoordsXY& screenCoords, int32_t* direction, TileElement** tileElement)
|
||||
{
|
||||
// First check if we point at an entrance or exit. In that case, we would want the path coming from the entrance/exit.
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
|
||||
if (window == nullptr || window->viewport == nullptr)
|
||||
{
|
||||
|
|
|
@ -41,179 +41,6 @@ namespace OpenRCT2
|
|||
|
||||
static int32_t _previousAbsoluteWheel = 0;
|
||||
|
||||
static bool WindowFitsBetweenOthers(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
if (loc.x + width <= w->windowPos.x)
|
||||
continue;
|
||||
if (loc.x >= w->windowPos.x + w->width)
|
||||
continue;
|
||||
if (loc.y + height <= w->windowPos.y)
|
||||
continue;
|
||||
if (loc.y >= w->windowPos.y + w->height)
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool WindowFitsWithinSpace(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
if (loc.x < 0)
|
||||
return false;
|
||||
if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
return false;
|
||||
if (loc.x + width > ContextGetWidth())
|
||||
return false;
|
||||
if (loc.y + height > ContextGetHeight())
|
||||
return false;
|
||||
return WindowFitsBetweenOthers(loc, width, height);
|
||||
}
|
||||
|
||||
static bool WindowFitsOnScreen(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
uint16_t screenWidth = ContextGetWidth();
|
||||
uint16_t screenHeight = ContextGetHeight();
|
||||
int32_t unk;
|
||||
|
||||
unk = -(width / 4);
|
||||
if (loc.x < unk)
|
||||
return false;
|
||||
unk = screenWidth + (unk * 2);
|
||||
if (loc.x > unk)
|
||||
return false;
|
||||
if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
return false;
|
||||
unk = screenHeight - (height / 4);
|
||||
if (loc.y > unk)
|
||||
return false;
|
||||
return WindowFitsBetweenOthers(loc, width, height);
|
||||
}
|
||||
|
||||
static ScreenCoordsXY ClampWindowToScreen(
|
||||
const ScreenCoordsXY& pos, const int32_t screenWidth, const int32_t screenHeight, const int32_t width,
|
||||
const int32_t height)
|
||||
{
|
||||
auto screenPos = pos;
|
||||
if (width > screenWidth || screenPos.x < 0)
|
||||
screenPos.x = 0;
|
||||
else if (screenPos.x + width > screenWidth)
|
||||
screenPos.x = screenWidth - width;
|
||||
|
||||
auto toolbarAllowance = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) ? 0 : (kTopToolbarHeight + 1);
|
||||
if (height - toolbarAllowance > screenHeight || screenPos.y < toolbarAllowance)
|
||||
screenPos.y = toolbarAllowance;
|
||||
else if (screenPos.y + height - toolbarAllowance > screenHeight)
|
||||
screenPos.y = screenHeight + toolbarAllowance - height;
|
||||
|
||||
return screenPos;
|
||||
}
|
||||
|
||||
static ScreenCoordsXY GetAutoPositionForNewWindow(int32_t width, int32_t height)
|
||||
{
|
||||
auto uiContext = GetContext()->GetUiContext();
|
||||
auto screenWidth = uiContext->GetWidth();
|
||||
auto screenHeight = uiContext->GetHeight();
|
||||
|
||||
// Place window in an empty corner of the screen
|
||||
const ScreenCoordsXY cornerPositions[] = {
|
||||
{ 0, 30 }, // topLeft
|
||||
{ screenWidth - width, 30 }, // topRight
|
||||
{ 0, screenHeight - 34 - height }, // bottomLeft
|
||||
{ screenWidth - width, screenHeight - 34 - height }, // bottomRight
|
||||
};
|
||||
|
||||
for (const auto& cornerPos : cornerPositions)
|
||||
{
|
||||
if (WindowFitsWithinSpace(cornerPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(cornerPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
// Place window next to another
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
const ScreenCoordsXY offsets[] = {
|
||||
{ w->width + 2, 0 },
|
||||
{ -w->width - 2, 0 },
|
||||
{ 0, w->height + 2 },
|
||||
{ 0, -w->height - 2 },
|
||||
{ w->width + 2, -w->height - 2 },
|
||||
{ -w->width - 2, -w->height - 2 },
|
||||
{ w->width + 2, w->height + 2 },
|
||||
{ -w->width - 2, w->height + 2 },
|
||||
};
|
||||
|
||||
for (const auto& offset : offsets)
|
||||
{
|
||||
auto screenPos = w->windowPos + offset;
|
||||
if (WindowFitsWithinSpace(screenPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Overlap
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
const ScreenCoordsXY offsets[] = {
|
||||
{ w->width + 2, 0 },
|
||||
{ -w->width - 2, 0 },
|
||||
{ 0, w->height + 2 },
|
||||
{ 0, -w->height - 2 },
|
||||
};
|
||||
|
||||
for (const auto& offset : offsets)
|
||||
{
|
||||
auto screenPos = w->windowPos + offset;
|
||||
if (WindowFitsOnScreen(screenPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cascade
|
||||
auto screenPos = ScreenCoordsXY{ 0, 30 };
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (screenPos == w->windowPos)
|
||||
{
|
||||
screenPos.x += 5;
|
||||
screenPos.y += 5;
|
||||
}
|
||||
}
|
||||
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
|
||||
static ScreenCoordsXY GetCentrePositionForNewWindow(int32_t width, int32_t height)
|
||||
{
|
||||
auto uiContext = GetContext()->GetUiContext();
|
||||
auto screenWidth = uiContext->GetWidth();
|
||||
auto screenHeight = uiContext->GetHeight();
|
||||
return ScreenCoordsXY{ (screenWidth - width) / 2, std::max(kTopToolbarHeight + 1, (screenHeight - height) / 2) };
|
||||
}
|
||||
|
||||
static int32_t WindowGetWidgetIndex(const WindowBase& w, Widget* widget)
|
||||
{
|
||||
const auto it = std::find_if(
|
||||
|
@ -441,7 +268,7 @@ namespace OpenRCT2
|
|||
// Check window cursor is over
|
||||
if (!(InputTestFlag(INPUT_FLAG_5)))
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindFromPoint(cursorState->position);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -734,96 +561,6 @@ namespace OpenRCT2::Ui::Windows
|
|||
static TextInputSession* _textInput;
|
||||
static WidgetIdentifier _currentTextBox = { { WindowClass::Null, 0 }, 0 };
|
||||
|
||||
WindowBase* WindowCreate(
|
||||
std::unique_ptr<WindowBase>&& wp, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags)
|
||||
{
|
||||
if (flags & WF_AUTO_POSITION)
|
||||
{
|
||||
if (flags & WF_CENTRE_SCREEN)
|
||||
{
|
||||
pos = GetCentrePositionForNewWindow(width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = GetAutoPositionForNewWindow(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there are any window slots left
|
||||
// include kWindowLimitReserved for items such as the main viewport and toolbars to not appear to be counted.
|
||||
if (g_window_list.size() >= static_cast<size_t>(Config::Get().general.WindowLimit + kWindowLimitReserved))
|
||||
{
|
||||
// Close least recently used window
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE)))
|
||||
{
|
||||
WindowClose(*w.get());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find right position to insert new window
|
||||
auto itDestPos = g_window_list.end();
|
||||
if (flags & WF_STICK_TO_BACK)
|
||||
{
|
||||
for (auto it = g_window_list.begin(); it != g_window_list.end(); it++)
|
||||
{
|
||||
if ((*it)->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!((*it)->flags & WF_STICK_TO_BACK))
|
||||
{
|
||||
itDestPos = it;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
{
|
||||
if ((*it)->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!((*it)->flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
itDestPos = it.base();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto itNew = g_window_list.insert(itDestPos, std::move(wp));
|
||||
auto w = itNew->get();
|
||||
|
||||
// Setup window
|
||||
w->classification = cls;
|
||||
w->flags = flags;
|
||||
|
||||
// Play sounds and flash the window
|
||||
if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
|
||||
{
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 0, pos.x + (width / 2));
|
||||
}
|
||||
|
||||
w->windowPos = pos;
|
||||
w->width = width;
|
||||
w->height = height;
|
||||
w->min_width = width;
|
||||
w->max_width = width;
|
||||
w->min_height = height;
|
||||
w->max_height = height;
|
||||
|
||||
w->focus = std::nullopt;
|
||||
|
||||
ColourSchemeUpdate(w);
|
||||
w->Invalidate();
|
||||
w->OnOpen();
|
||||
return w;
|
||||
}
|
||||
|
||||
WindowBase* WindowGetListening()
|
||||
{
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
|
@ -871,7 +608,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
if (_usingWidgetTextBox)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(_currentTextBox.window.classification, _currentTextBox.window.number);
|
||||
_currentTextBox.window.classification = WindowClass::Null;
|
||||
_currentTextBox.window.number = 0;
|
||||
|
@ -897,7 +634,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (_usingWidgetTextBox)
|
||||
{
|
||||
_textBoxFrameNo = 0;
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(_currentTextBox.window.classification, _currentTextBox.window.number);
|
||||
WidgetInvalidate(*w, _currentTextBox.widget_index);
|
||||
w->OnTextInput(_currentTextBox.widget_index, _textBoxInput);
|
||||
|
|
|
@ -55,42 +55,6 @@ namespace OpenRCT2
|
|||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
WindowBase* WindowCreate(
|
||||
std::unique_ptr<WindowBase>&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags);
|
||||
template<typename T, typename... TArgs, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* WindowCreate(
|
||||
WindowClass cls, const ScreenCoordsXY& pos = {}, int32_t width = 0, int32_t height = 0, uint32_t flags = 0,
|
||||
TArgs&&... args)
|
||||
{
|
||||
return static_cast<T*>(WindowCreate(std::make_unique<T>(std::forward<TArgs>(args)...), cls, pos, width, height, flags));
|
||||
}
|
||||
template<typename T, typename... TArgs, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* WindowCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags, TArgs&&... args)
|
||||
{
|
||||
return static_cast<T*>(
|
||||
WindowCreate(std::make_unique<T>(std::forward<TArgs>(args)...), cls, {}, width, height, flags | WF_AUTO_POSITION));
|
||||
}
|
||||
template<typename T, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* WindowFocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, int32_t width, int32_t height, uint32_t flags = 0)
|
||||
{
|
||||
auto* w = WindowBringToFrontByClass(cls);
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = WindowCreate<T>(cls, pos, width, height, flags);
|
||||
}
|
||||
return static_cast<T*>(w);
|
||||
}
|
||||
template<typename T, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* WindowFocusOrCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags = 0)
|
||||
{
|
||||
auto* w = WindowBringToFrontByClass(cls);
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = WindowCreate<T>(cls, width, height, flags);
|
||||
}
|
||||
return static_cast<T*>(w);
|
||||
}
|
||||
|
||||
void RideConstructionToolupdateEntranceExit(const ScreenCoordsXY& screenCoords);
|
||||
void RideConstructionToolupdateConstruct(const ScreenCoordsXY& screenCoords);
|
||||
void RideConstructionTooldownConstruct(const ScreenCoordsXY& screenCoords);
|
||||
|
|
|
@ -268,7 +268,7 @@ namespace OpenRCT2::Scripting
|
|||
customTool.onUp = dukValue["onUp"];
|
||||
customTool.onFinish = dukValue["onFinish"];
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto toolbarWindow = windowMgr->FindByClass(WindowClass::TopToolbar);
|
||||
if (toolbarWindow != nullptr)
|
||||
{
|
||||
|
|
|
@ -1111,7 +1111,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
static rct_windownumber GetNewWindowNumber()
|
||||
{
|
||||
auto result = _nextWindowNumber++;
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
while (windowMgr->FindByNumber(WindowClass::Custom, result) != nullptr)
|
||||
{
|
||||
result++;
|
||||
|
@ -1126,15 +1126,17 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
auto desc = CustomWindowDesc::FromDukValue(dukDesc);
|
||||
uint16_t windowFlags = WF_RESIZABLE | WF_TRANSPARENT;
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
CustomWindow* window{};
|
||||
if (desc.X && desc.Y)
|
||||
{
|
||||
window = WindowCreate<CustomWindow>(
|
||||
window = windowMgr->Create<CustomWindow>(
|
||||
WindowClass::Custom, { *desc.X, *desc.Y }, desc.Width, desc.Height, windowFlags, owner, desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
window = WindowCreate<CustomWindow>(WindowClass::Custom, desc.Width, desc.Height, windowFlags, owner, desc);
|
||||
window = windowMgr->Create<CustomWindow>(WindowClass::Custom, desc.Width, desc.Height, windowFlags, owner, desc);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ namespace OpenRCT2::Scripting
|
|||
if (_class == WindowClass::MainWindow)
|
||||
return WindowGetMain();
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
return windowMgr->FindByNumber(_class, _number);
|
||||
}
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ namespace OpenRCT2::Scripting
|
|||
if (_class == WindowClass::MainWindow)
|
||||
return WindowGetMain();
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
return windowMgr->FindByNumber(_class, _number);
|
||||
}
|
||||
|
||||
|
|
|
@ -326,10 +326,11 @@ namespace OpenRCT2::Scripting
|
|||
|
||||
void bringToFront()
|
||||
{
|
||||
auto w = GetWindow();
|
||||
auto* w = GetWindow();
|
||||
if (w != nullptr)
|
||||
{
|
||||
WindowBringToFront(*w);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
w = windowMgr->BringToFront(*w);
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
}
|
||||
}
|
||||
|
@ -360,7 +361,7 @@ namespace OpenRCT2::Scripting
|
|||
private:
|
||||
WindowBase* GetWindow() const
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
return windowMgr->FindByNumber(_class, _number);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -430,7 +430,7 @@ namespace OpenRCT2::Title
|
|||
|
||||
void PrepareParkForPlayback()
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
auto& gameState = GetGameState();
|
||||
windowManager->SetMainView(gameState.SavedView, gameState.SavedViewZoom, gameState.SavedViewRotation);
|
||||
ResetEntitySpatialIndices();
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <SDL_clipboard.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/Version.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
|
@ -20,6 +19,7 @@
|
|||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -280,6 +280,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* AboutOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<AboutWindow>(WindowClass::About, WW, WH, WF_CENTRE_SCREEN);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<AboutWindow>(WindowClass::About, WW, WH, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/object/ObjectManager.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -343,7 +344,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* AssetPacksOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto flags = WF_AUTO_POSITION | WF_CENTRE_SCREEN;
|
||||
return WindowFocusOrCreate<AssetPacksWindow>(WindowClass::AssetPacks, WW, WH, flags);
|
||||
|
||||
return windowMgr->FocusOrCreate<AssetPacksWindow>(WindowClass::AssetPacks, WW, WH, flags);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <openrct2/object/BannerSceneryEntry.h>
|
||||
#include <openrct2/object/ObjectEntryManager.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Banner.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
#include <openrct2/world/tile_element/BannerElement.h>
|
||||
|
@ -312,12 +313,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* BannerOpen(rct_windownumber number)
|
||||
{
|
||||
auto w = static_cast<BannerWindow*>(WindowBringToFrontByNumber(WindowClass::Banner, number));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = static_cast<BannerWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Banner, number));
|
||||
|
||||
if (w != nullptr)
|
||||
return w;
|
||||
|
||||
w = WindowCreate<BannerWindow>(WindowClass::Banner, WW, WH, 0);
|
||||
w = windowMgr->Create<BannerWindow>(WindowClass::Banner, WW, WH, 0);
|
||||
|
||||
if (w != nullptr)
|
||||
w->Initialise(number);
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <fstream>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/PlatformEnvironment.h>
|
||||
|
@ -21,6 +20,7 @@
|
|||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/platform/Platform.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <vector>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -318,7 +318,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* ChangelogOpen(int personality)
|
||||
{
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::Changelog);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::Changelog);
|
||||
if (window == nullptr)
|
||||
{
|
||||
// Create a new centred window
|
||||
|
@ -328,7 +329,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
int32_t height = (screenHeight * 4) / 5;
|
||||
|
||||
auto pos = ChangelogWindow::GetCentrePositionForNewWindow(width, height);
|
||||
auto* newWindow = WindowCreate<ChangelogWindow>(WindowClass::Changelog, pos, width, height, WF_RESIZABLE);
|
||||
auto* newWindow = windowMgr->Create<ChangelogWindow>(WindowClass::Changelog, pos, width, height, WF_RESIZABLE);
|
||||
newWindow->SetPersonality(personality);
|
||||
return newWindow;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <openrct2/localisation/Localisation.Date.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/util/Util.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/tile_element/SurfaceElement.h>
|
||||
|
@ -1345,10 +1346,11 @@ static StringId window_cheats_page_titles[] = {
|
|||
|
||||
WindowBase* CheatsOpen()
|
||||
{
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::Cheats);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::Cheats);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<CheatsWindow>(WindowClass::Cheats, ScreenCoordsXY(32, 32), WW, WH);
|
||||
window = windowMgr->Create<CheatsWindow>(WindowClass::Cheats, ScreenCoordsXY(32, 32), WW, WH);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <openrct2/actions/ClearAction.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
@ -343,7 +342,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
case WIDX_BACKGROUND:
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::Error) == nullptr && (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
||||
{
|
||||
auto action = GetClearAction();
|
||||
|
@ -380,7 +379,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* ClearSceneryOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<CleanSceneryWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<CleanSceneryWindow>(
|
||||
WindowClass::ClearScenery, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/localisation/Currency.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -227,6 +228,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* CustomCurrencyOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<CustomCurrencyWindow>(WindowClass::CustomCurrencyConfig, WW, WH, WF_CENTRE_SCREEN);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<CustomCurrencyWindow>(WindowClass::CustomCurrencyConfig, WW, WH, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <openrct2/paint/Paint.h>
|
||||
#include <openrct2/paint/tile_element/Paint.TileElement.h>
|
||||
#include <openrct2/ride/TrackPaint.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -153,7 +154,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* DebugPaintOpen()
|
||||
{
|
||||
auto* window = WindowFocusOrCreate<DebugPaintWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<DebugPaintWindow>(
|
||||
WindowClass::DebugPaint, { 16, ContextGetHeight() - 16 - 33 - WINDOW_HEIGHT }, WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT);
|
||||
|
||||
|
|
|
@ -9,13 +9,11 @@
|
|||
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/actions/RideDemolishAction.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
@ -103,21 +101,20 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* RideDemolishPromptOpen(const Ride& ride)
|
||||
{
|
||||
WindowBase* w;
|
||||
DemolishRidePromptWindow* newWindow;
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FindByClass(WindowClass::DemolishRidePrompt);
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
w = windowMgr->FindByClass(WindowClass::DemolishRidePrompt);
|
||||
DemolishRidePromptWindow* newWindow;
|
||||
if (w != nullptr)
|
||||
{
|
||||
auto windowPos = w->windowPos;
|
||||
WindowClose(*w);
|
||||
newWindow = WindowCreate<DemolishRidePromptWindow>(
|
||||
newWindow = windowMgr->Create<DemolishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
newWindow = WindowCreate<DemolishRidePromptWindow>(
|
||||
newWindow = windowMgr->Create<DemolishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -357,7 +358,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowDropdownClose();
|
||||
|
||||
// Create the window (width/height position are set later)
|
||||
auto* w = WindowCreate<DropdownWindow>(WindowClass::Dropdown, width, custom_height, WF_STICK_TO_FRONT);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->Create<DropdownWindow>(WindowClass::Dropdown, width, custom_height, WF_STICK_TO_FRONT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetTextItems(screenPos, extray, colour, custom_height, flags, num_items, width);
|
||||
|
@ -390,7 +392,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowDropdownClose();
|
||||
|
||||
// Create the window (width/height position are set later)
|
||||
auto* w = WindowCreate<DropdownWindow>(WindowClass::Dropdown, itemWidth, itemHeight, WF_STICK_TO_FRONT);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->Create<DropdownWindow>(WindowClass::Dropdown, itemWidth, itemHeight, WF_STICK_TO_FRONT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetImageItems({ x, y }, extray, colour, numItems, itemWidth, itemHeight, numColumns);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <openrct2/management/Research.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
@ -381,7 +382,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* EditorBottomToolbarOpen()
|
||||
{
|
||||
auto* window = WindowCreate<EditorBottomToolbarWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create<EditorBottomToolbarWindow>(
|
||||
WindowClass::BottomToolbar, ScreenCoordsXY(0, ContextGetHeight() - 32), ContextGetWidth(), 32,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <openrct2-ui/input/MouseInput.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Editor.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/Input.h>
|
||||
|
@ -26,7 +25,6 @@
|
|||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/ride/RideManager.hpp>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
||||
|
@ -490,7 +488,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (windowPos.x <= screenCoords.x && windowPos.y < screenCoords.y && windowPos.x + width > screenCoords.x
|
||||
&& windowPos.y + height > screenCoords.y)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WidgetIndex widgetIndex = windowMgr->FindWidgetFromPoint(*this, screenCoords);
|
||||
|
||||
auto& widget = widgets[widgetIndex];
|
||||
|
@ -595,7 +593,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* EditorInventionsListOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<InventionListWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<InventionListWindow>(
|
||||
WindowClass::EditorInventionList, WW, WH, WF_NO_SCROLLING | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
}
|
||||
#pragma endregion
|
||||
|
@ -615,7 +614,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
CursorID OnCursor(const WidgetIndex widx, const ScreenCoordsXY& screenCoords, const CursorID defaultCursor) override
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* inventionListWindow = static_cast<InventionListWindow*>(
|
||||
windowMgr->FindByClass(WindowClass::EditorInventionList));
|
||||
if (inventionListWindow != nullptr)
|
||||
|
@ -634,7 +633,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void OnMoved(const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* inventionListWindow = static_cast<InventionListWindow*>(
|
||||
windowMgr->FindByClass(WindowClass::EditorInventionList));
|
||||
if (inventionListWindow == nullptr)
|
||||
|
@ -691,8 +690,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
static void WindowEditorInventionsListDragOpen(
|
||||
ResearchItem* researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth)
|
||||
{
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
WindowCloseByClass(WindowClass::EditorInventionListDrag);
|
||||
auto* wnd = WindowCreate<InventionDragWindow>(
|
||||
auto* wnd = windowMgr->Create<InventionDragWindow>(
|
||||
WindowClass::EditorInventionListDrag, 10, 14, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING);
|
||||
if (wnd != nullptr)
|
||||
{
|
||||
|
@ -702,7 +702,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
static const ResearchItem* WindowEditorInventionsListDragGetItem()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* wnd = static_cast<InventionDragWindow*>(windowMgr->FindByClass(WindowClass::EditorInventionListDrag));
|
||||
if (wnd == nullptr)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/scenes/title/TitleScene.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <span>
|
||||
|
@ -1644,7 +1643,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* EditorObjectSelectionOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<EditorObjectSelectionWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<EditorObjectSelectionWindow>(
|
||||
WindowClass::EditorObjectSelection, 755, 400, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
}
|
||||
|
||||
|
@ -1746,7 +1746,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
ContextShowError(STR_INVALID_SELECTION_OF_OBJECTS, errorString, {});
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::EditorObjectSelection);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <openrct2/ride/RideManager.hpp>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -1169,11 +1170,12 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* EditorObjectiveOptionsOpen()
|
||||
{
|
||||
auto window = WindowBringToFrontByClass(WindowClass::EditorObjectiveOptions);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::EditorObjectiveOptions);
|
||||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = WindowCreate<EditorObjectiveOptionsWindow>(
|
||||
window = windowMgr->Create<EditorObjectiveOptionsWindow>(
|
||||
WindowClass::EditorObjectiveOptions, 450, 225, WF_10 | WF_CENTRE_SCREEN);
|
||||
|
||||
return window;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <openrct2/object/ObjectLimits.h>
|
||||
#include <openrct2/object/ObjectManager.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/tile_element/EntranceElement.h>
|
||||
#include <openrct2/world/tile_element/PathElement.h>
|
||||
#include <openrct2/world/tile_element/Slope.h>
|
||||
|
@ -391,14 +392,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* EditorParkEntranceOpen()
|
||||
{
|
||||
WindowBase* window;
|
||||
|
||||
// Check if window is already open
|
||||
window = WindowBringToFrontByClass(WindowClass::EditorParkEntrance);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::EditorParkEntrance);
|
||||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = WindowCreate<EditorParkEntrance>(
|
||||
window = windowMgr->Create<EditorParkEntrance>(
|
||||
WindowClass::EditorParkEntrance, kWindowWidth, kWindowHeight, WF_10 | WF_RESIZABLE);
|
||||
|
||||
return window;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/management/Finance.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Climate.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
|
@ -1254,6 +1255,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* EditorScenarioOptionsOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<EditorScenarioOptionsWindow>(WindowClass::EditorScenarioOptions, 280, 148, WF_NO_SCROLLING);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<EditorScenarioOptionsWindow>(
|
||||
WindowClass::EditorScenarioOptions, 280, 148, WF_NO_SCROLLING);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <openrct2/drawing/Font.h>
|
||||
#include <openrct2/interface/Screenshot.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -138,7 +139,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
windowPosition.y = std::clamp(windowPosition.y, 22, ContextGetHeight() - height - 40);
|
||||
|
||||
auto errorWindow = std::make_unique<ErrorWindow>(std::move(buffer), numLines, autoClose);
|
||||
return WindowCreate(
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create(
|
||||
std::move(errorWindow), WindowClass::Error, windowPosition, width, height, WF_STICK_TO_FRONT | WF_TRANSPARENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <openrct2-ui/interface/Graph.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/actions/ParkSetLoanAction.h>
|
||||
#include <openrct2/actions/ParkSetResearchFundingAction.h>
|
||||
|
@ -23,6 +22,7 @@
|
|||
#include <openrct2/ride/ShopItem.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -879,7 +879,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
static FinancesWindow* FinancesWindowOpen(uint8_t page)
|
||||
{
|
||||
auto* window = WindowFocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
|
||||
|
||||
if (window != nullptr && page != WINDOW_FINANCES_PAGE_SUMMARY)
|
||||
window->SetPage(page);
|
||||
|
@ -889,7 +890,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* FinancesOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
|
||||
}
|
||||
|
||||
WindowBase* FinancesResearchOpen()
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <openrct2/paint/VirtualFloor.h>
|
||||
#include <openrct2/platform/Platform.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/ConstructionClearance.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
|
@ -1236,7 +1235,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
}
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* self = static_cast<FootpathWindow*>(windowMgr->FindByClass(WindowClass::Footpath));
|
||||
if (self == nullptr)
|
||||
{
|
||||
|
@ -1627,7 +1626,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return WindowFocusOrCreate<FootpathWindow>(WindowClass::Footpath, WW_WINDOW, WH_WINDOW, 0);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<FootpathWindow>(WindowClass::Footpath, WW_WINDOW, WH_WINDOW, 0);
|
||||
}
|
||||
|
||||
void WindowFootpathResetSelectedPath()
|
||||
|
@ -1637,7 +1637,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutTurnLeft()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1651,7 +1651,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutTurnRight()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1665,7 +1665,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutSlopeDown()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1679,7 +1679,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutSlopeUp()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1693,7 +1693,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutDemolishCurrent()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1707,7 +1707,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutBuildCurrent()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1725,7 +1725,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
void ToggleFootpathWindow()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::Footpath) == nullptr)
|
||||
{
|
||||
ContextOpenWindow(WindowClass::Footpath);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <openrct2/object/PeepAnimationsObject.h>
|
||||
#include <openrct2/peep/PeepSpriteIds.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -677,7 +678,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
uint32_t line_height = FontGetLineHeight(FontStyle::Medium);
|
||||
uint32_t toolbar_height = line_height * 2 + 12;
|
||||
|
||||
GameBottomToolbar* window = WindowCreate<GameBottomToolbar>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create<GameBottomToolbar>(
|
||||
WindowClass::BottomToolbar, ScreenCoordsXY(0, screenHeight - toolbar_height), screenWidth, toolbar_height,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include <openrct2/ride/ShopItem.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/util/Util.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
|
@ -639,7 +638,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
pickupAction.SetCallback([peepnum = number](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* wind = windowMgr->FindByNumber(WindowClass::Peep, peepnum);
|
||||
if (wind != nullptr)
|
||||
{
|
||||
|
@ -1911,14 +1910,15 @@ namespace OpenRCT2::Ui::Windows
|
|||
return StaffOpen(peep);
|
||||
}
|
||||
|
||||
auto* window = static_cast<GuestWindow*>(WindowBringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying()));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = static_cast<GuestWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying()));
|
||||
if (window == nullptr)
|
||||
{
|
||||
int32_t windowWidth = 192;
|
||||
if (Config::Get().general.DebuggingTools)
|
||||
windowWidth += TabWidth;
|
||||
|
||||
window = WindowCreate<GuestWindow>(WindowClass::Peep, windowWidth, 157, WF_RESIZABLE);
|
||||
window = windowMgr->Create<GuestWindow>(WindowClass::Peep, windowWidth, 157, WF_RESIZABLE);
|
||||
if (window == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <vector>
|
||||
|
@ -971,10 +970,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* GuestListOpen()
|
||||
{
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::GuestList);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::GuestList);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<GuestListWindow>(WindowClass::GuestList, 350, 330, WF_10 | WF_RESIZABLE);
|
||||
window = windowMgr->Create<GuestListWindow>(WindowClass::GuestList, 350, 330, WF_10 | WF_RESIZABLE);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
@ -994,7 +994,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowGuestListRefreshList()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FindByClass(WindowClass::GuestList);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <openrct2/ride/TrackDesign.h>
|
||||
#include <openrct2/ride/TrackDesignRepository.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -430,7 +431,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
int32_t screenHeight = ContextGetHeight();
|
||||
auto screenPos = ScreenCoordsXY{ screenWidth / 2 - 201, std::max(kTopToolbarHeight + 1, screenHeight / 2 - 200) };
|
||||
|
||||
auto* window = WindowFocusOrCreate<InstallTrackWindow>(WindowClass::InstallTrack, screenPos, WW, WH, 0);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<InstallTrackWindow>(WindowClass::InstallTrack, screenPos, WW, WH, 0);
|
||||
window->SetupTrack(path, std::move(trackDesign));
|
||||
|
||||
return window;
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <openrct2/object/TerrainEdgeObject.h>
|
||||
#include <openrct2/object/TerrainSurfaceObject.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
|
@ -400,7 +399,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
void LandToolDrag(const ScreenCoordsXY& screenPos)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FindFromPoint(screenPos);
|
||||
if (window == nullptr)
|
||||
return;
|
||||
|
@ -873,7 +872,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* LandOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<LandWindow>(WindowClass::Land, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<LandWindow>(WindowClass::Land, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/tile_element/SurfaceElement.h>
|
||||
|
||||
|
@ -585,7 +586,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* LandRightsOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<LandRightsWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<LandRightsWindow>(
|
||||
WindowClass::LandRights, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Editor.h>
|
||||
#include <openrct2/FileClassifier.h>
|
||||
#include <openrct2/Game.h>
|
||||
|
@ -38,6 +37,7 @@
|
|||
#include <openrct2/scenes/title/TitleScene.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <string>
|
||||
|
@ -1335,7 +1335,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
const u8string path = GetDir(type);
|
||||
|
||||
auto* w = static_cast<LoadSaveWindow*>(WindowBringToFrontByClass(WindowClass::Loadsave));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<LoadSaveWindow*>(windowMgr->BringToFrontByClass(WindowClass::Loadsave));
|
||||
if (w == nullptr)
|
||||
{
|
||||
if (config.FileBrowserWidth < kWindowSizeMin.width || config.FileBrowserHeight < kWindowSizeMin.height
|
||||
|
@ -1349,7 +1350,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
auto width = config.FileBrowserWidth;
|
||||
auto height = config.FileBrowserHeight;
|
||||
|
||||
w = WindowCreate<LoadSaveWindow>(
|
||||
w = windowMgr->Create<LoadSaveWindow>(
|
||||
WindowClass::Loadsave, width, height, WF_STICK_TO_FRONT | WF_RESIZABLE | WF_AUTO_POSITION | WF_CENTRE_SCREEN,
|
||||
type);
|
||||
}
|
||||
|
@ -1483,7 +1484,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt);
|
||||
|
||||
return WindowCreate<OverwritePromptWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<OverwritePromptWindow>(
|
||||
WindowClass::LoadsaveOverwritePrompt, OVERWRITE_WW, OVERWRITE_WH,
|
||||
WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_CENTRE_SCREEN, name, path);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -75,7 +76,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* MainOpen()
|
||||
{
|
||||
return WindowCreate<MainWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<MainWindow>(
|
||||
WindowClass::MainWindow, { 0, 0 }, ContextGetWidth(), ContextGetHeight(), WF_STICK_TO_BACK);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <openrct2/ride/TrainManager.h>
|
||||
#include <openrct2/ride/Vehicle.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
@ -276,7 +275,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void OnMouseUp(WidgetIndex widgetIndex) override
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
|
@ -356,7 +355,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void OnUpdate() override
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
// the flickering frequency is reduced by 4, compared to the original
|
||||
// it was done due to inability to reproduce original frequency
|
||||
|
@ -600,7 +599,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
// Set the pressed widgets
|
||||
pressed_widgets = 0;
|
||||
|
@ -1253,7 +1252,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
try
|
||||
{
|
||||
WindowBase* w = WindowFocusOrCreate<MapWindow>(WindowClass::Map, 245, 259, WF_10);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FocusOrCreate<MapWindow>(WindowClass::Map, 245, 259, WF_10);
|
||||
w->selected_tab = 0;
|
||||
w->list_information_type = 0;
|
||||
return w;
|
||||
|
@ -1266,10 +1266,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowMapReset()
|
||||
{
|
||||
WindowBase* w;
|
||||
|
||||
// Check if window is even opened
|
||||
w = WindowBringToFrontByClass(WindowClass::Map);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->BringToFrontByClass(WindowClass::Map);
|
||||
if (w == nullptr)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <openrct2/object/TerrainEdgeObject.h>
|
||||
#include <openrct2/object/TerrainSurfaceObject.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Map.h>
|
||||
#include <openrct2/world/map_generator/MapGen.h>
|
||||
|
@ -1529,7 +1530,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* MapgenOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<MapGenWindow>(WindowClass::Mapgen, WW, WH, WF_10 | WF_AUTO_POSITION | WF_CENTRE_SCREEN);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<MapGenWindow>(WindowClass::Mapgen, WW, WH, WF_10 | WF_AUTO_POSITION | WF_CENTRE_SCREEN);
|
||||
}
|
||||
|
||||
static void HeightmapLoadsaveCallback(int32_t result, const utf8* path)
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <openrct2/Input.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -97,7 +96,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId));
|
||||
|
||||
auto& im = GetInputManager();
|
||||
auto* wm = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* wm = GetWindowManager();
|
||||
if (_cursorHoldDuration < 25 || stringId == STR_NONE || im.IsModifierKeyPressed(ModifierKey::ctrl)
|
||||
|| im.IsModifierKeyPressed(ModifierKey::shift) || wm->FindByClass(WindowClass::Error) != nullptr)
|
||||
{
|
||||
|
@ -116,7 +115,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
const CursorState* state = ContextGetCursorState();
|
||||
auto pos = state->position + ScreenCoordsXY{ -width / 2, 15 };
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (auto w = windowMgr->FindByClass(WindowClass::MapTooltip))
|
||||
{
|
||||
w->Invalidate();
|
||||
|
@ -126,7 +125,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
w = WindowCreate<MapTooltip>(
|
||||
w = windowMgr->Create<MapTooltip>(
|
||||
WindowClass::MapTooltip, pos, width, height, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/ride/Track.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/tile_element/EntranceElement.h>
|
||||
|
@ -437,13 +436,14 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* MazeConstructionOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<MazeConstructionWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<MazeConstructionWindow>(
|
||||
WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE);
|
||||
}
|
||||
|
||||
void WindowMazeConstructionUpdatePressedWidgets()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr)
|
||||
return;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <openrct2/drawing/Text.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -184,10 +185,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* MultiplayerOpen()
|
||||
{
|
||||
// Check if window is already open
|
||||
WindowBase* window = WindowBringToFrontByClass(WindowClass::Multiplayer);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::Multiplayer);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<MultiplayerWindow>(
|
||||
window = windowMgr->Create<MultiplayerWindow>(
|
||||
WindowClass::Multiplayer, 320, 144, WF_10 | WF_RESIZABLE | WF_AUTO_POSITION);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <openrct2/Context.h>
|
||||
#include <openrct2/drawing/Text.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -136,16 +135,16 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
ContextForceCloseWindowByClass(WindowClass::ProgressWindow);
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
NetworkStatusWindow* window;
|
||||
if ((window = static_cast<NetworkStatusWindow*>(windowMgr->FindByClass(WindowClass::NetworkStatus))) != nullptr)
|
||||
{
|
||||
WindowBringToFront(*window);
|
||||
windowMgr->BringToFront(*window);
|
||||
}
|
||||
else
|
||||
{
|
||||
window = WindowCreate<NetworkStatusWindow>(
|
||||
window = windowMgr->Create<NetworkStatusWindow>(
|
||||
WindowClass::NetworkStatus, 400, 90, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
}
|
||||
|
||||
|
@ -157,7 +156,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
// force close
|
||||
void WindowNetworkStatusClose()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = windowMgr->FindByClass(WindowClass::NetworkStatus);
|
||||
if (window == nullptr)
|
||||
{
|
||||
|
@ -172,8 +171,10 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
ContextForceCloseWindowByClass(WindowClass::ProgressWindow);
|
||||
|
||||
auto window = WindowFocusOrCreate<NetworkStatusWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<NetworkStatusWindow>(
|
||||
WindowClass::NetworkStatus, 400, 90, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN);
|
||||
|
||||
char password[33]{};
|
||||
WindowTextInputRawOpen(window, WIDX_PASSWORD, STR_PASSWORD_REQUIRED, STR_PASSWORD_REQUIRED_DESC, {}, password, 32);
|
||||
window->SetPassword(password);
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/actions/ParkMarketingAction.h>
|
||||
#include <openrct2/core/BitSet.hpp>
|
||||
|
@ -23,7 +22,6 @@
|
|||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/ride/RideManager.hpp>
|
||||
#include <openrct2/ride/ShopItem.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -404,7 +402,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* NewCampaignOpen(int16_t campaignType)
|
||||
{
|
||||
auto w = static_cast<NewCampaignWindow*>(WindowBringToFrontByClass(WindowClass::NewCampaign));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<NewCampaignWindow*>(windowMgr->BringToFrontByClass(WindowClass::NewCampaign));
|
||||
if (w != nullptr)
|
||||
{
|
||||
if (w->GetCampaignType() == campaignType)
|
||||
|
@ -413,7 +412,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowClose(*w);
|
||||
}
|
||||
|
||||
w = WindowCreate<NewCampaignWindow>(WindowClass::NewCampaign, WW, WH, 0);
|
||||
w = windowMgr->Create<NewCampaignWindow>(WindowClass::NewCampaign, WW, WH, 0);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetCampaign(campaignType);
|
||||
|
@ -423,7 +422,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowCampaignRefreshRides()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = static_cast<NewCampaignWindow*>(windowMgr->FindByClass(WindowClass::NewCampaign));
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include <openrct2/ride/TrackData.h>
|
||||
#include <openrct2/ride/TrackDesignRepository.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
@ -1071,9 +1070,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* NewRideOpen()
|
||||
{
|
||||
WindowBase* window;
|
||||
|
||||
window = WindowBringToFrontByClass(WindowClass::ConstructRide);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::ConstructRide);
|
||||
if (window)
|
||||
{
|
||||
return window;
|
||||
|
@ -1082,7 +1080,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowCloseByClass(WindowClass::TrackDesignList);
|
||||
WindowCloseByClass(WindowClass::TrackDesignPlace);
|
||||
|
||||
window = WindowCreate<NewRideWindow>(WindowClass::ConstructRide, WindowWidth, WindowHeight, WF_10 | WF_AUTO_POSITION);
|
||||
window = windowMgr->Create<NewRideWindow>(
|
||||
WindowClass::ConstructRide, WindowWidth, WindowHeight, WF_10 | WF_AUTO_POSITION);
|
||||
return window;
|
||||
}
|
||||
|
||||
|
@ -1099,7 +1098,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
void WindowNewRideFocus(RideSelection rideItem)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = static_cast<NewRideWindow*>(windowMgr->FindByClass(WindowClass::ConstructRide));
|
||||
if (!w)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <openrct2/object/ObjectManager.h>
|
||||
#include <openrct2/object/PeepAnimationsObject.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -323,6 +324,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* NewsOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<NewsWindow>(WindowClass::RecentNews, WW, WH, 0);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<NewsWindow>(WindowClass::RecentNews, WW, WH, 0);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -282,6 +283,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* NewsOptionsOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<NewsOptionsWindow>(WindowClass::NotificationOptions, WW, WH, WF_CENTRE_SCREEN);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<NewsOptionsWindow>(WindowClass::NotificationOptions, WW, WH, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <mutex>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/core/Console.hpp>
|
||||
#include <openrct2/core/Http.h>
|
||||
|
@ -25,6 +24,7 @@
|
|||
#include <openrct2/object/ObjectRepository.h>
|
||||
#include <openrct2/platform/Platform.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
@ -576,10 +576,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* ObjectLoadErrorOpen(utf8* path, size_t numMissingObjects, const ObjectEntryDescriptor* missingObjects)
|
||||
{
|
||||
// Check if window is already open
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::ObjectLoadError);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::ObjectLoadError);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<ObjectLoadErrorWindow>(WindowClass::ObjectLoadError, WW, WH, 0);
|
||||
window = windowMgr->Create<ObjectLoadErrorWindow>(WindowClass::ObjectLoadError, WW, WH, 0);
|
||||
}
|
||||
|
||||
static_cast<ObjectLoadErrorWindow*>(window)->Initialise(path, numMissingObjects, missingObjects);
|
||||
|
|
|
@ -12,14 +12,12 @@
|
|||
* the window has been changed to a tab interface similar to the options window seen in Locomotion.
|
||||
*/
|
||||
|
||||
#include "../interface/Theme.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Theme.h>
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/PlatformEnvironment.h>
|
||||
#include <openrct2/actions/ScenarioSetSettingAction.h>
|
||||
|
@ -45,6 +43,7 @@
|
|||
#include <openrct2/scenes/title/TitleSequenceManager.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::Audio;
|
||||
|
@ -2216,6 +2215,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* OptionsOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<OptionsWindow>(WindowClass::Options, WW, WH, WF_CENTRE_SCREEN);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<OptionsWindow>(WindowClass::Options, WW, WH, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -7,17 +7,15 @@
|
|||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../interface/Theme.h"
|
||||
|
||||
#include <array>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Graph.h>
|
||||
#include <openrct2-ui/interface/LandTool.h>
|
||||
#include <openrct2-ui/interface/Objective.h>
|
||||
#include <openrct2-ui/interface/Theme.h>
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/Input.h>
|
||||
|
@ -32,6 +30,7 @@
|
|||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -1298,7 +1297,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
static ParkWindow* ParkWindowOpen(uint8_t page)
|
||||
{
|
||||
auto* wnd = WindowFocusOrCreate<ParkWindow>(WindowClass::ParkInformation, 230, 174 + 9, WF_10);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* wnd = windowMgr->FocusOrCreate<ParkWindow>(WindowClass::ParkInformation, 230, 174 + 9, WF_10);
|
||||
if (wnd != nullptr && page != WINDOW_PARK_PAGE_ENTRANCE)
|
||||
{
|
||||
wnd->OnMouseUp(WIDX_TAB_1 + page);
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include <openrct2/entity/Staff.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
|
@ -275,7 +274,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
bool IsStaffWindowOpen()
|
||||
{
|
||||
// If staff window for this patrol area was closed, tool is no longer active
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto staffWindow = windowMgr->FindByNumber(WindowClass::Peep, _staffId);
|
||||
return staffWindow != nullptr;
|
||||
}
|
||||
|
@ -294,7 +293,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* PatrolAreaOpen(EntityId staffId)
|
||||
{
|
||||
auto w = WindowFocusOrCreate<PatrolAreaWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FocusOrCreate<PatrolAreaWindow>(
|
||||
WindowClass::PatrolArea, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -305,7 +305,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
EntityId WindowPatrolAreaGetCurrentStaffId()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto current = reinterpret_cast<PatrolAreaWindow*>(windowMgr->FindByClass(WindowClass::PatrolArea));
|
||||
return current != nullptr ? current->GetStaffId() : EntityId::GetNull();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <openrct2/network/NetworkAction.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <utility>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -624,10 +625,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* PlayerOpen(uint8_t id)
|
||||
{
|
||||
auto* window = static_cast<PlayerWindow*>(WindowBringToFrontByNumber(WindowClass::Player, id));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = static_cast<PlayerWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Player, id));
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<PlayerWindow>(WindowClass::Player, 240, 170, WF_RESIZABLE);
|
||||
window = windowMgr->Create<PlayerWindow>(WindowClass::Player, 240, 170, WF_RESIZABLE);
|
||||
}
|
||||
|
||||
window->Init(id);
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
|
@ -236,16 +235,16 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
ContextForceCloseWindowByClass(WindowClass::NetworkStatus);
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
ProgressWindow* window;
|
||||
if ((window = static_cast<ProgressWindow*>(windowMgr->FindByClass(WindowClass::ProgressWindow))) != nullptr)
|
||||
{
|
||||
WindowBringToFront(*window);
|
||||
windowMgr->BringToFront(*window);
|
||||
}
|
||||
else
|
||||
{
|
||||
window = WindowCreate<ProgressWindow>(
|
||||
window = windowMgr->Create<ProgressWindow>(
|
||||
WindowClass::ProgressWindow, kWindowWidth, kWindowHeight,
|
||||
WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
}
|
||||
|
@ -257,7 +256,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void ProgressWindowSet(uint32_t currentProgress, uint32_t totalCount, StringId format)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = windowMgr->FindByClass(WindowClass::ProgressWindow);
|
||||
if (window == nullptr)
|
||||
{
|
||||
|
@ -270,7 +269,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
// Closes the window, deliberately *without* executing the callback.
|
||||
void ProgressWindowClose()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = windowMgr->FindByClass(WindowClass::ProgressWindow);
|
||||
if (window == nullptr)
|
||||
{
|
||||
|
|
|
@ -9,12 +9,10 @@
|
|||
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/actions/RideDemolishAction.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
@ -104,18 +102,18 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
RefurbishRidePromptWindow* newWindow;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::DemolishRidePrompt);
|
||||
if (w != nullptr)
|
||||
{
|
||||
auto windowPos = w->windowPos;
|
||||
WindowClose(*w);
|
||||
newWindow = WindowCreate<RefurbishRidePromptWindow>(
|
||||
newWindow = windowMgr->Create<RefurbishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
newWindow = WindowCreate<RefurbishRidePromptWindow>(
|
||||
newWindow = windowMgr->Create<RefurbishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <openrct2/management/Research.h>
|
||||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
||||
|
@ -304,7 +305,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* ResearchOpen()
|
||||
{
|
||||
ResearchWindow* window = WindowFocusOrCreate<ResearchWindow>(WindowClass::Research, WW_FUNDING, WH_FUNDING, WF_10);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<ResearchWindow>(WindowClass::Research, WW_FUNDING, WH_FUNDING, WF_10);
|
||||
window->SetPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT);
|
||||
return window;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
#include <openrct2/ride/TrackDesignRepository.h>
|
||||
#include <openrct2/ride/Vehicle.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/util/Util.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
|
@ -1137,7 +1136,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
if (newPage == WINDOW_RIDE_PAGE_VEHICLE)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto constructionWindow = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (constructionWindow != nullptr && constructionWindow->number == number)
|
||||
{
|
||||
|
@ -1633,7 +1632,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (ride != nullptr)
|
||||
{
|
||||
RideConstructionStart(*ride);
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(WindowClass::RideConstruction, ride->id.ToUnderlying()) != nullptr)
|
||||
{
|
||||
Close();
|
||||
|
@ -6939,7 +6938,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
static RideWindow* WindowRideOpen(const Ride& ride)
|
||||
{
|
||||
return WindowCreate<RideWindow>(WindowClass::Ride, 316, 207, WF_10 | WF_RESIZABLE, ride);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<RideWindow>(WindowClass::Ride, 316, 207, WF_10 | WF_RESIZABLE, ride);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6953,7 +6953,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RideWindow* w = static_cast<RideWindow*>(WindowBringToFrontByNumber(WindowClass::Ride, ride.id.ToUnderlying()));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
RideWindow* w = static_cast<RideWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Ride, ride.id.ToUnderlying()));
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = WindowRideOpen(ride);
|
||||
|
@ -6990,7 +6991,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (ride.GetRideTypeDescriptor().HasFlag(RtdFlag::noVehicles))
|
||||
return RideMainOpen(ride);
|
||||
|
||||
auto* w = static_cast<RideWindow*>(WindowBringToFrontByNumber(WindowClass::Ride, ride.id.ToUnderlying()));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<RideWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Ride, ride.id.ToUnderlying()));
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = WindowRideOpen(ride);
|
||||
|
@ -7080,7 +7082,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
view++;
|
||||
}
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<RideWindow*>(windowMgr->FindByNumber(WindowClass::Ride, ride->id.ToUnderlying()));
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -7118,7 +7120,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
w = static_cast<RideWindow*>(
|
||||
openedPeepWindow ? windowMgr->FindByNumber(WindowClass::Ride, ride->id.ToUnderlying())
|
||||
: WindowBringToFrontByNumber(WindowClass::Ride, ride->id.ToUnderlying()));
|
||||
: windowMgr->BringToFrontByNumber(WindowClass::Ride, ride->id.ToUnderlying()));
|
||||
}
|
||||
|
||||
if (w == nullptr)
|
||||
|
@ -7134,7 +7136,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideInvalidateVehicle(const Vehicle& vehicle)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<RideWindow*>(windowMgr->FindByNumber(WindowClass::Ride, vehicle.ride.ToUnderlying()));
|
||||
if (w == nullptr)
|
||||
return;
|
||||
|
@ -7152,7 +7154,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRidePaintResetVehicle(RideId rideIndex)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = static_cast<RideWindow*>(windowMgr->FindByNumber(WindowClass::Ride, rideIndex.ToUnderlying()));
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include <openrct2/ride/Track.h>
|
||||
#include <openrct2/ride/TrackData.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/ConstructionClearance.h>
|
||||
|
@ -212,7 +211,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
/* move to ride.c */
|
||||
static void CloseRideWindowForConstruction(RideId rideId)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(WindowClass::Ride, rideId.ToUnderlying());
|
||||
if (w != nullptr && w->page == 1)
|
||||
WindowClose(*w);
|
||||
|
@ -2803,16 +2802,18 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowRideConstructionUpdateDisabledPieces(currentRide->type);
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
const auto& rtd = currentRide->GetRideTypeDescriptor();
|
||||
switch (rtd.ConstructionWindowContext)
|
||||
{
|
||||
case RideConstructionWindowContext::Maze:
|
||||
return ContextOpenWindowView(WV_MAZE_CONSTRUCTION);
|
||||
case RideConstructionWindowContext::Default:
|
||||
return WindowCreate<RideConstructionWindow>(
|
||||
return windowMgr->Create<RideConstructionWindow>(
|
||||
WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE);
|
||||
}
|
||||
return WindowCreate<RideConstructionWindow>(
|
||||
return windowMgr->Create<RideConstructionWindow>(
|
||||
WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE);
|
||||
}
|
||||
|
||||
|
@ -2820,7 +2821,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
if (_rideConstructionState == RideConstructionState::State0)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -2838,7 +2839,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
static void WindowRideConstructionDoEntranceExitCheck()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
auto ride = GetRide(_currentRideIndex);
|
||||
if (w == nullptr || ride == nullptr)
|
||||
|
@ -3074,7 +3075,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
return;
|
||||
}
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = static_cast<RideConstructionWindow*>(windowMgr->FindByClass(WindowClass::RideConstruction));
|
||||
if (!window)
|
||||
{
|
||||
|
@ -3306,7 +3307,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
const auto& rtd = ride->GetRideTypeDescriptor();
|
||||
if (rtd.specialType != RtdSpecialType::maze)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = static_cast<RideConstructionWindow*>(windowMgr->FindByClass(WindowClass::RideConstruction));
|
||||
if (!window)
|
||||
{
|
||||
|
@ -3610,7 +3611,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION);
|
||||
ContextBroadcastIntent(&intent);
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr)
|
||||
break;
|
||||
|
@ -3677,7 +3678,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
_currentTrackSelectionFlags = 0;
|
||||
WindowRideConstructionUpdateActiveElements();
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr)
|
||||
break;
|
||||
|
@ -3731,7 +3732,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutTurnLeft()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty)
|
||||
{
|
||||
|
@ -3982,7 +3983,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutTurnRight()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty)
|
||||
{
|
||||
|
@ -4236,7 +4237,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutUseTrackDefault()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty)
|
||||
{
|
||||
|
@ -4267,7 +4268,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutSlopeDown()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty)
|
||||
{
|
||||
|
@ -4378,7 +4379,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutSlopeUp()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty)
|
||||
{
|
||||
|
@ -4489,7 +4490,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutChainLiftToggle()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_CHAIN_LIFT)
|
||||
|| w->widgets[WIDX_CHAIN_LIFT].type == WindowWidgetType::Empty)
|
||||
|
@ -4502,7 +4503,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutBankLeft()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT)
|
||||
|| w->widgets[WIDX_BANK_STRAIGHT].type == WindowWidgetType::Empty)
|
||||
|
@ -4539,7 +4540,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutBankRight()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT)
|
||||
|| w->widgets[WIDX_BANK_STRAIGHT].type == WindowWidgetType::Empty)
|
||||
|
@ -4576,7 +4577,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutPreviousTrack()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_PREVIOUS_SECTION)
|
||||
|| w->widgets[WIDX_PREVIOUS_SECTION].type == WindowWidgetType::Empty)
|
||||
|
@ -4589,7 +4590,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutNextTrack()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_NEXT_SECTION)
|
||||
|| w->widgets[WIDX_NEXT_SECTION].type == WindowWidgetType::Empty)
|
||||
|
@ -4602,7 +4603,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutBuildCurrent()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_CONSTRUCT) || w->widgets[WIDX_CONSTRUCT].type == WindowWidgetType::Empty)
|
||||
{
|
||||
|
@ -4614,7 +4615,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowRideConstructionKeyboardShortcutDemolishCurrent()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || WidgetIsDisabled(*w, WIDX_DEMOLISH) || w->widgets[WIDX_DEMOLISH].type == WindowWidgetType::Empty)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <openrct2/ride/RideManager.hpp>
|
||||
#include <openrct2/ride/RideRatings.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
|
@ -977,10 +978,12 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* RideListOpen()
|
||||
{
|
||||
// Check if window is already open
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::RideList);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::RideList);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<RideListWindow>(WindowClass::RideList, ScreenCoordsXY(32, 32), WW, WH, WF_10 | WF_RESIZABLE);
|
||||
window = windowMgr->Create<RideListWindow>(
|
||||
WindowClass::RideList, ScreenCoordsXY(32, 32), WW, WH, WF_10 | WF_RESIZABLE);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -229,8 +230,10 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
}
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
// Check if window is already open
|
||||
WindowBase* window = WindowBringToFrontByClass(WindowClass::SavePrompt);
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::SavePrompt);
|
||||
if (window != nullptr)
|
||||
{
|
||||
WindowClose(*window);
|
||||
|
@ -251,7 +254,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
|
||||
auto savePromptWindow = std::make_unique<SavePromptWindow>(prompt_mode);
|
||||
return WindowCreate(
|
||||
return windowMgr->Create(
|
||||
std::move(savePromptWindow), WindowClass::SavePrompt, {}, width, height,
|
||||
WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_CENTRE_SCREEN | WF_AUTO_POSITION);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <openrct2/scenario/ScenarioRepository.h>
|
||||
#include <openrct2/scenario/ScenarioSources.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <vector>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -767,7 +768,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* ScenarioselectOpen(std::function<void(std::string_view)> callback)
|
||||
{
|
||||
auto* window = static_cast<ScenarioSelectWindow*>(WindowBringToFrontByClass(WindowClass::ScenarioSelect));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = static_cast<ScenarioSelectWindow*>(windowMgr->BringToFrontByClass(WindowClass::ScenarioSelect));
|
||||
if (window != nullptr)
|
||||
{
|
||||
return window;
|
||||
|
@ -776,7 +778,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
int32_t screenWidth = ContextGetWidth();
|
||||
int32_t screenHeight = ContextGetHeight();
|
||||
ScreenCoordsXY screenPos = { (screenWidth - WW) / 2, std::max(kTopToolbarHeight + 1, (screenHeight - WH) / 2) };
|
||||
window = WindowCreate<ScenarioSelectWindow>(WindowClass::ScenarioSelect, screenPos, WW, WH, 0, callback);
|
||||
window = windowMgr->Create<ScenarioSelectWindow>(WindowClass::ScenarioSelect, screenPos, WW, WH, 0, callback);
|
||||
return window;
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include <openrct2/object/WallSceneryEntry.h>
|
||||
#include <openrct2/paint/VirtualFloor.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/util/Util.h>
|
||||
#include <openrct2/world/ConstructionClearance.h>
|
||||
|
@ -422,7 +421,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
// Find out what scenery the cursor is over
|
||||
const CursorState* state = ContextGetCursorState();
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WidgetIndex widgetIndex = windowMgr->FindWidgetFromPoint(*this, state->position);
|
||||
if (widgetIndex == WIDX_SCENERY_LIST)
|
||||
{
|
||||
|
@ -451,7 +450,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
const CursorState* state = ContextGetCursorState();
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* other = windowMgr->FindFromPoint(state->position);
|
||||
if (other == this)
|
||||
{
|
||||
|
@ -2435,7 +2434,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, uint8_t* outQuadrant,
|
||||
Direction* outRotation)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FindByClass(WindowClass::Scenery);
|
||||
|
||||
if (w == nullptr)
|
||||
|
@ -2633,7 +2632,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
void Sub6E1F34PathItem(
|
||||
const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, int32_t* outZ)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FindByClass(WindowClass::Scenery);
|
||||
|
||||
if (w == nullptr)
|
||||
|
@ -2667,7 +2666,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
void Sub6E1F34Wall(
|
||||
const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, uint8_t* outEdges)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FindByClass(WindowClass::Scenery);
|
||||
|
||||
if (w == nullptr)
|
||||
|
@ -2758,7 +2757,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
void Sub6E1F34LargeScenery(
|
||||
const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, Direction* outDirection)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FindByClass(WindowClass::Scenery);
|
||||
|
||||
if (w == nullptr)
|
||||
|
@ -2860,7 +2859,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, int32_t* outZ,
|
||||
Direction* outDirection)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FindByClass(WindowClass::Scenery);
|
||||
|
||||
if (w == nullptr)
|
||||
|
@ -3210,10 +3209,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* SceneryOpen()
|
||||
{
|
||||
auto* w = static_cast<SceneryWindow*>(WindowBringToFrontByClass(WindowClass::Scenery));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<SceneryWindow*>(windowMgr->BringToFrontByClass(WindowClass::Scenery));
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = WindowCreate<SceneryWindow>(WindowClass::Scenery);
|
||||
w = windowMgr->Create<SceneryWindow>(WindowClass::Scenery);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
@ -3222,7 +3222,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
const ScenerySelection& scenery, const std::optional<colour_t> primary, const std::optional<colour_t> secondary,
|
||||
const std::optional<colour_t> tertiary, const std::optional<colour_t> rotation)
|
||||
{
|
||||
auto* w = static_cast<SceneryWindow*>(WindowBringToFrontByClass(WindowClass::Scenery));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<SceneryWindow*>(windowMgr->BringToFrontByClass(WindowClass::Scenery));
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetSelectedItem(scenery, primary, secondary, tertiary, rotation);
|
||||
|
@ -3232,7 +3233,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
void WindowScenerySetSelectedTab(const ObjectEntryIndex sceneryGroupIndex)
|
||||
{
|
||||
// Should this bring to front?
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<SceneryWindow*>(windowMgr->FindByClass(WindowClass::Scenery));
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -3259,7 +3260,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
const ScenerySelection WindowSceneryGetTabSelection()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<SceneryWindow*>(windowMgr->FindByClass(WindowClass::Scenery));
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -3273,7 +3274,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowSceneryInit()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<SceneryWindow*>(windowMgr->FindByClass(WindowClass::Scenery));
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
|
|
@ -11,11 +11,9 @@
|
|||
#include <openrct2-ui/interface/LandTool.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
||||
|
@ -207,11 +205,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* SceneryScatterOpen()
|
||||
{
|
||||
// Check if window is already open
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FindByClass(WindowClass::SceneryScatter);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<SceneryScatterWindow>(WindowClass::SceneryScatter, 86, 100, 0);
|
||||
window = windowMgr->Create<SceneryScatterWindow>(WindowClass::SceneryScatter, 86, 100, 0);
|
||||
}
|
||||
|
||||
return window;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/platform/Platform.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <tuple>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -546,11 +547,12 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* ServerListOpen()
|
||||
{
|
||||
// Check if window is already open
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::ServerList);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::ServerList);
|
||||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = WindowCreate<ServerListWindow>(
|
||||
window = windowMgr->Create<ServerListWindow>(
|
||||
WindowClass::ServerList, WWIDTH_MIN, WHEIGHT_MIN, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
|
||||
return window;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/interface/Chat.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -283,7 +284,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* ServerStartOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<ServerStartWindow>(WindowClass::ServerStart, WW, WH, WF_CENTRE_SCREEN);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<ServerStartWindow>(WindowClass::ServerStart, WW, WH, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -81,8 +80,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
auto registeredShortcut = shortcutManager.GetShortcut(shortcutId);
|
||||
if (registeredShortcut != nullptr)
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowCloseByClass(WindowClass::ChangeKeyboardShortcut);
|
||||
auto w = WindowCreate<ChangeShortcutWindow>(
|
||||
auto* w = windowMgr->Create<ChangeShortcutWindow>(
|
||||
WindowClass::ChangeKeyboardShortcut, CHANGE_WW, CHANGE_WH, WF_CENTRE_SCREEN);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -544,7 +544,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void ChangeShortcutWindow::NotifyShortcutKeysWindow()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->FindByClass(WindowClass::KeyboardShortcutList);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -554,10 +554,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* ShortcutKeysOpen()
|
||||
{
|
||||
auto w = WindowBringToFrontByClass(WindowClass::KeyboardShortcutList);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->BringToFrontByClass(WindowClass::KeyboardShortcutList);
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = WindowCreate<ShortcutKeysWindow>(WindowClass::KeyboardShortcutList, WW, WH, WF_RESIZABLE);
|
||||
w = windowMgr->Create<ShortcutKeysWindow>(WindowClass::KeyboardShortcutList, WW, WH, WF_RESIZABLE);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
@ -600,7 +601,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
case WIDX_RESET_PROMPT_RESET:
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->FindByClass(WindowClass::KeyboardShortcutList);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -619,7 +620,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* ResetShortcutKeysPromptOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<ResetShortcutKeysPrompt>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<ResetShortcutKeysPrompt>(
|
||||
WindowClass::ResetShortcutKeysPrompt, RESET_PROMPT_WW, RESET_PROMPT_WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
}
|
||||
#pragma endregion
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <openrct2/object/ObjectEntryManager.h>
|
||||
#include <openrct2/object/WallSceneryEntry.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Banner.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
#include <openrct2/world/tile_element/LargeSceneryElement.h>
|
||||
|
@ -334,12 +335,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* SignOpen(rct_windownumber number)
|
||||
{
|
||||
auto* w = static_cast<SignWindow*>(WindowBringToFrontByNumber(WindowClass::Banner, number));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<SignWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Banner, number));
|
||||
|
||||
if (w != nullptr)
|
||||
return w;
|
||||
|
||||
w = WindowCreate<SignWindow>(WindowClass::Banner, WW, WH, 0);
|
||||
w = windowMgr->Create<SignWindow>(WindowClass::Banner, WW, WH, 0);
|
||||
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
|
@ -357,12 +359,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* SignSmallOpen(rct_windownumber number)
|
||||
{
|
||||
auto* w = static_cast<SignWindow*>(WindowBringToFrontByNumber(WindowClass::Banner, number));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<SignWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Banner, number));
|
||||
|
||||
if (w != nullptr)
|
||||
return w;
|
||||
|
||||
w = WindowCreate<SignWindow>(WindowClass::Banner, WW, WH, 0);
|
||||
w = windowMgr->Create<SignWindow>(WindowClass::Banner, WW, WH, 0);
|
||||
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <openrct2/object/PeepAnimationsObject.h>
|
||||
#include <openrct2/peep/PeepAnimations.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
|
@ -381,7 +380,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* wind = windowMgr->FindByNumber(WindowClass::Peep, peepnum);
|
||||
if (wind != nullptr)
|
||||
{
|
||||
|
@ -1276,13 +1275,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* StaffOpen(Peep* peep)
|
||||
{
|
||||
auto w = static_cast<StaffWindow*>(WindowBringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying()));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
auto w = static_cast<StaffWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying()));
|
||||
if (w != nullptr)
|
||||
return w;
|
||||
|
||||
w = WindowCreate<StaffWindow>(WindowClass::Peep, WW, WH, WF_10 | WF_RESIZABLE);
|
||||
|
||||
w = windowMgr->Create<StaffWindow>(WindowClass::Peep, WW, WH, WF_10 | WF_RESIZABLE);
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <openrct2/entity/Staff.h>
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -98,7 +99,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* StaffFirePromptOpen(Peep* peep)
|
||||
{
|
||||
// Check if the confirm window already exists
|
||||
auto* window = WindowFocusOrCreate<StaffFirePromptWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<StaffFirePromptWindow>(
|
||||
WindowClass::FirePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
window->SetWindowNumber(peep->Id.ToUnderlying());
|
||||
return window;
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include <openrct2/object/ObjectManager.h>
|
||||
#include <openrct2/object/PeepAnimationsObject.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/util/Util.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
|
@ -202,7 +201,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
|
||||
// Enable highlighting of these staff members in map window
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::Map) != nullptr)
|
||||
{
|
||||
for (auto peep : EntityList<Staff>())
|
||||
|
@ -745,12 +744,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* StaffListOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<StaffListWindow>(WindowClass::StaffList, WW, WH, WF_10 | WF_RESIZABLE);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<StaffListWindow>(WindowClass::StaffList, WW, WH, WF_10 | WF_RESIZABLE);
|
||||
}
|
||||
|
||||
void WindowStaffListRefresh()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FindByClass(WindowClass::StaffList);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -364,7 +363,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* GetParentWindow() const
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return HasParentWindow() ? windowMgr->FindByNumber(_parentWidget.window.classification, _parentWidget.window.number)
|
||||
: nullptr;
|
||||
}
|
||||
|
@ -374,10 +373,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* call_w, WidgetIndex call_widget, StringId title, StringId description, const Formatter& descriptionArgs,
|
||||
const_utf8string existing_text, int32_t maxLength)
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowCloseByClass(WindowClass::Textinput);
|
||||
|
||||
auto height = TextInputWindow::CalculateWindowHeight(existing_text);
|
||||
auto w = WindowCreate<TextInputWindow>(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
auto w = windowMgr->Create<TextInputWindow>(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetParentWindow(call_w, call_widget);
|
||||
|
@ -390,8 +390,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
std::string_view title, std::string_view description, std::string_view initialValue, size_t maxLength,
|
||||
std::function<void(std::string_view)> callback, std::function<void()> cancelCallback)
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto height = TextInputWindow::CalculateWindowHeight(initialValue);
|
||||
auto w = WindowCreate<TextInputWindow>(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
auto w = windowMgr->Create<TextInputWindow>(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetTitle(title, description);
|
||||
|
@ -424,7 +425,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
|
||||
// The window can be potentially closed within a callback, we need to check if its still alive.
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
w = windowMgr->FindByNumber(wndClass, wndNumber);
|
||||
if (w != nullptr)
|
||||
w->Invalidate();
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/platform/Platform.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -387,7 +386,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
pressed_widgets = pressedWidgets | (1 << widgetIndex);
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::Dropdown) == nullptr)
|
||||
{
|
||||
_classIndex = -1;
|
||||
|
@ -972,14 +971,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* ThemesOpen()
|
||||
{
|
||||
WindowBase* window;
|
||||
|
||||
// Check if window is already open
|
||||
window = WindowBringToFrontByClass(WindowClass::Themes);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::Themes);
|
||||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = WindowCreate<ThemesWindow>(WindowClass::Themes, 320, 107, WF_10 | WF_RESIZABLE);
|
||||
window = windowMgr->Create<ThemesWindow>(WindowClass::Themes, 320, 107, WF_10 | WF_RESIZABLE);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/ride/Track.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/TileInspectorGlobals.h>
|
||||
#include <openrct2/world/Banner.h>
|
||||
|
@ -2440,15 +2439,16 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
|
||||
WindowBase* TileInspectorOpen()
|
||||
{
|
||||
WindowBase* window = WindowBringToFrontByClass(WindowClass::TileInspector);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->BringToFrontByClass(WindowClass::TileInspector);
|
||||
if (window == nullptr)
|
||||
window = WindowCreate<TileInspector>(WindowClass::TileInspector, ScreenCoordsXY(0, 29), WW, WH, WF_RESIZABLE);
|
||||
window = windowMgr->Create<TileInspector>(WindowClass::TileInspector, ScreenCoordsXY(0, 29), WW, WH, WF_RESIZABLE);
|
||||
return window;
|
||||
}
|
||||
|
||||
void WindowTileInspectorClearClipboard()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (window != nullptr)
|
||||
static_cast<TileInspector*>(window)->ClearClipboard();
|
||||
|
@ -2456,7 +2456,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
|
||||
void WindowTileInspectorKeyboardShortcutToggleInvisibility()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (window != nullptr)
|
||||
static_cast<TileInspector*>(window)->ToggleInvisibility();
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -54,7 +55,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* TitleExitOpen()
|
||||
{
|
||||
return WindowCreate<TitleExitWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<TitleExitWindow>(
|
||||
WindowClass::TitleExit, ScreenCoordsXY(ContextGetWidth() - 40, ContextGetHeight() - 64), 40, 64,
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -67,10 +68,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* TitleLogoOpen()
|
||||
{
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::TitleLogo);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::TitleLogo);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<TitleLogoWindow>(
|
||||
window = windowMgr->Create<TitleLogoWindow>(
|
||||
WindowClass::TitleLogo, ScreenCoordsXY(0, 0), WW, WH, WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
}
|
||||
return window;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/scripting/CustomMenu.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Editor.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/Input.h>
|
||||
|
@ -121,7 +120,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
WindowBase* windowToOpen = nullptr;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
switch (widgetIndex)
|
||||
{
|
||||
|
@ -129,7 +128,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
windowToOpen = windowMgr->FindByClass(WindowClass::ScenarioSelect);
|
||||
if (windowToOpen != nullptr)
|
||||
{
|
||||
WindowBringToFront(*windowToOpen);
|
||||
windowMgr->BringToFront(*windowToOpen);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -142,7 +141,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
windowToOpen = windowMgr->FindByClass(WindowClass::Loadsave);
|
||||
if (windowToOpen != nullptr)
|
||||
{
|
||||
WindowBringToFront(*windowToOpen);
|
||||
windowMgr->BringToFront(*windowToOpen);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -156,7 +155,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
windowToOpen = windowMgr->FindByClass(WindowClass::ServerList);
|
||||
if (windowToOpen != nullptr)
|
||||
{
|
||||
WindowBringToFront(*windowToOpen);
|
||||
windowMgr->BringToFront(*windowToOpen);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -287,7 +286,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* TitleMenuOpen()
|
||||
{
|
||||
const uint16_t windowHeight = MenuButtonDims.height + UpdateButtonDims.height;
|
||||
return WindowCreate<TitleMenuWindow>(
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<TitleMenuWindow>(
|
||||
WindowClass::TitleMenu, ScreenCoordsXY(0, ContextGetHeight() - 182), 0, windowHeight,
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -52,10 +53,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* TitleOptionsOpen()
|
||||
{
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::TitleOptions);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::TitleOptions);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<TitleOptionsWindow>(
|
||||
window = windowMgr->Create<TitleOptionsWindow>(
|
||||
WindowClass::TitleOptions, ScreenCoordsXY(ContextGetWidth() - 80, 0), 80, 15,
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <openrct2/Version.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -39,10 +40,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* TitleVersionOpen()
|
||||
{
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::TitleVersion);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::TitleVersion);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<TitleVersionWindow>(
|
||||
window = windowMgr->Create<TitleVersionWindow>(
|
||||
WindowClass::TitleVersion, ScreenCoordsXY(kTextOffset, ContextGetHeight() - 30), WW, WH,
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -158,7 +159,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
auto windowPos = tooltipWindow->windowPos;
|
||||
auto width = tooltipWindow->width;
|
||||
auto height = tooltipWindow->height;
|
||||
WindowCreate(
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
windowMgr->Create(
|
||||
std::move(tooltipWindow), WindowClass::Tooltip, windowPos, width, height, WF_TRANSPARENT | WF_STICK_TO_FRONT);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Cheats.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/Editor.h>
|
||||
#include <openrct2/Game.h>
|
||||
|
@ -777,7 +776,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
void ApplyFootpathPressed()
|
||||
{
|
||||
// Footpath button pressed down
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::Footpath) == nullptr)
|
||||
pressed_widgets &= ~(1uLL << WIDX_PATH);
|
||||
else
|
||||
|
@ -998,7 +997,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* TopToolbarOpen()
|
||||
{
|
||||
TopToolbar* window = WindowCreate<TopToolbar>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create<TopToolbar>(
|
||||
WindowClass::TopToolbar, ScreenCoordsXY(0, 0), ContextGetWidth(), kTopToolbarHeight + 1,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
|
||||
|
@ -1140,7 +1140,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
break;
|
||||
case DDIDX_VIEW_CLIPPING:
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::ViewClipping) == nullptr)
|
||||
{
|
||||
ContextOpenWindow(WindowClass::ViewClipping);
|
||||
|
@ -1509,7 +1509,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1,
|
||||
colours[0].withFlag(ColourFlag::translucent, true), Dropdown::Flag::StayOpen, TOP_TOOLBAR_DEBUG_COUNT);
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
Dropdown::SetChecked(DDIDX_DEBUG_PAINT, windowMgr->FindByClass(WindowClass::DebugPaint) != nullptr);
|
||||
}
|
||||
|
||||
|
@ -1528,7 +1528,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
case DDIDX_DEBUG_PAINT:
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::DebugPaint) == nullptr)
|
||||
{
|
||||
ContextOpenWindow(WindowClass::DebugPaint);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/platform/Platform.h>
|
||||
#include <openrct2/ride/TrackDesignRepository.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -109,7 +110,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
WindowCloseByClass(WindowClass::ManageTrackDesign);
|
||||
auto trackDesignManageWindow = std::make_unique<TrackDesignManageWindow>(tdFileRef);
|
||||
auto* window = WindowCreate(
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create(
|
||||
std::move(trackDesignManageWindow), WindowClass::ManageTrackDesign, {}, WW, WH,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_AUTO_POSITION);
|
||||
|
||||
|
@ -194,7 +197,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
int32_t screenWidth = ContextGetWidth();
|
||||
int32_t screenHeight = ContextGetHeight();
|
||||
auto trackDeletePromptWindow = std::make_unique<TrackDeletePromptWindow>(tdFileRef);
|
||||
WindowCreate(
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
windowMgr->Create(
|
||||
std::move(trackDeletePromptWindow), WindowClass::TrackDeletePrompt,
|
||||
ScreenCoordsXY(
|
||||
std::max(kTopToolbarHeight + 1, (screenWidth - WW_DELETE_PROMPT) / 2), (screenHeight - WH_DELETE_PROMPT) / 2),
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <openrct2/ride/TrackDesign.h>
|
||||
#include <openrct2/ride/TrackDesignRepository.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
@ -279,7 +278,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
// Unable to build track
|
||||
Audio::Play3D(Audio::SoundId::Error, trackLoc);
|
||||
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = GetWindowManager();
|
||||
windowManager->ShowError(res.GetErrorTitle(), res.GetErrorMessage());
|
||||
return;
|
||||
}
|
||||
|
@ -301,7 +300,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
_currentRideIndex = rideId;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (TrackDesignAreEntranceAndExitPlaced())
|
||||
{
|
||||
auto intent = Intent(WindowClass::Ride);
|
||||
|
@ -737,7 +736,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowCloseConstructionWindows();
|
||||
|
||||
auto* window = WindowFocusOrCreate<TrackDesignPlaceWindow>(WindowClass::TrackDesignPlace, WW, WH, 0);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<TrackDesignPlaceWindow>(WindowClass::TrackDesignPlace, WW, WH, 0);
|
||||
if (window != nullptr)
|
||||
{
|
||||
window->Init(std::move(openTrackDesign));
|
||||
|
@ -747,7 +747,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void TrackPlaceClearProvisionalTemporarily()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* trackPlaceWnd = static_cast<TrackDesignPlaceWindow*>(windowMgr->FindByClass(WindowClass::TrackDesignPlace));
|
||||
if (trackPlaceWnd != nullptr)
|
||||
{
|
||||
|
@ -757,7 +757,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void TrackPlaceRestoreProvisional()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* trackPlaceWnd = static_cast<TrackDesignPlaceWindow*>(windowMgr->FindByClass(WindowClass::TrackDesignPlace));
|
||||
if (trackPlaceWnd != nullptr)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include <openrct2/ride/TrackDesign.h>
|
||||
#include <openrct2/ride/TrackDesignRepository.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <vector>
|
||||
|
@ -770,12 +769,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
screenPos = { 0, kTopToolbarHeight + 2 };
|
||||
}
|
||||
return WindowCreate<TrackListWindow>(WindowClass::TrackDesignList, WW, WH, 0, item);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<TrackListWindow>(WindowClass::TrackDesignList, WW, WH, 0, item);
|
||||
}
|
||||
|
||||
void WindowTrackDesignListReloadTracks()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* trackListWindow = static_cast<TrackListWindow*>(windowMgr->FindByClass(WindowClass::TrackDesignList));
|
||||
if (trackListWindow != nullptr)
|
||||
{
|
||||
|
@ -785,7 +785,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowTrackDesignListSetBeingUpdated(const bool beingUpdated)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* trackListWindow = static_cast<TrackListWindow*>(windowMgr->FindByClass(WindowClass::TrackDesignList));
|
||||
if (trackListWindow != nullptr)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <openrct2-ui/interface/Theme.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
|
@ -24,6 +23,7 @@
|
|||
#include <openrct2/localisation/Localisation.Date.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Climate.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
|
@ -249,9 +249,10 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* TransparencyOpen()
|
||||
{
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::Transparency);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::Transparency);
|
||||
if (window == nullptr)
|
||||
window = WindowCreate<TransparencyWindow>(WindowClass::Transparency, ScreenCoordsXY(32, 32), WW, WH);
|
||||
window = windowMgr->Create<TransparencyWindow>(WindowClass::Transparency, ScreenCoordsXY(32, 32), WW, WH);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/paint/Paint.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Location.hpp>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -400,10 +401,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* ViewClippingOpen()
|
||||
{
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::ViewClipping);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::ViewClipping);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<ViewClippingWindow>(WindowClass::ViewClipping, ScreenCoordsXY(32, 32), WW, WH);
|
||||
window = windowMgr->Create<ViewClippingWindow>(WindowClass::ViewClipping, ScreenCoordsXY(32, 32), WW, WH);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <openrct2/audio/audio.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Map.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -229,7 +230,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
int32_t width = (screenWidth / 2);
|
||||
int32_t height = (screenHeight / 2);
|
||||
|
||||
auto* w = WindowCreate<ViewportWindow>(WindowClass::Viewport, std::max(WW, width), std::max(WH, height), WF_RESIZABLE);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->Create<ViewportWindow>(
|
||||
WindowClass::Viewport, std::max(WW, width), std::max(WH, height), WF_RESIZABLE);
|
||||
|
||||
if (w != nullptr)
|
||||
return w;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
|
@ -253,7 +252,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
void WaterToolDrag(const ScreenCoordsXY& screenPos)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FindFromPoint(screenPos);
|
||||
if (window == nullptr || window->viewport == nullptr)
|
||||
return;
|
||||
|
@ -426,7 +425,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* WaterOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<WaterWindow>(WindowClass::Water, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<WaterWindow>(WindowClass::Water, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1558,7 +1558,7 @@ namespace OpenRCT2
|
|||
|
||||
void ContextInit()
|
||||
{
|
||||
GetContext()->GetUiContext()->GetWindowManager()->Init();
|
||||
GetWindowManager()->Init();
|
||||
}
|
||||
|
||||
bool ContextLoadParkFromStream(void* stream)
|
||||
|
@ -1676,55 +1676,55 @@ void ContextSetCursorTrap(bool value)
|
|||
|
||||
WindowBase* ContextOpenWindow(WindowClass wc)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
return windowManager->OpenWindow(wc);
|
||||
}
|
||||
|
||||
WindowBase* ContextOpenWindowView(uint8_t wc)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
return windowManager->OpenView(wc);
|
||||
}
|
||||
|
||||
WindowBase* ContextOpenDetailWindow(uint8_t type, int32_t id)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
return windowManager->OpenDetails(type, id);
|
||||
}
|
||||
|
||||
WindowBase* ContextOpenIntent(Intent* intent)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
return windowManager->OpenIntent(intent);
|
||||
}
|
||||
|
||||
void ContextBroadcastIntent(Intent* intent)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
windowManager->BroadcastIntent(*intent);
|
||||
}
|
||||
|
||||
void ContextForceCloseWindowByClass(WindowClass windowClass)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
windowManager->ForceClose(windowClass);
|
||||
}
|
||||
|
||||
WindowBase* ContextShowError(StringId title, StringId message, const Formatter& args, const bool autoClose /* = false */)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
return windowManager->ShowError(title, message, args, autoClose);
|
||||
}
|
||||
|
||||
void ContextHandleInput()
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
windowManager->HandleInput();
|
||||
}
|
||||
|
||||
void ContextInputHandleKeyboard(bool isTitle)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
windowManager->HandleKeyboard(isTitle);
|
||||
}
|
||||
|
||||
|
|
|
@ -325,7 +325,7 @@ namespace OpenRCT2::Editor
|
|||
return;
|
||||
}
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
|
||||
switch (GetGameState().EditorStep)
|
||||
{
|
||||
|
@ -382,7 +382,7 @@ namespace OpenRCT2::Editor
|
|||
|
||||
static void FinaliseMainView()
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
auto& gameState = GetGameState();
|
||||
windowManager->SetMainView(gameState.SavedView, gameState.SavedViewZoom, gameState.SavedViewRotation);
|
||||
|
||||
|
|
|
@ -451,7 +451,7 @@ namespace OpenRCT2::GameActions
|
|||
|
||||
if (result.Error != GameActions::Status::Ok && shouldShowError)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
windowManager->ShowError(result.GetErrorTitle(), result.GetErrorMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ GameActions::Result ParkMarketingAction::Execute() const
|
|||
MarketingNewCampaign(campaign);
|
||||
|
||||
// We are only interested in invalidating the finances (marketing) window
|
||||
auto windowManager = OpenRCT2::GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = OpenRCT2::Ui::GetWindowManager();
|
||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_UPDATE_CASH));
|
||||
|
||||
return CreateResult();
|
||||
|
|
|
@ -71,7 +71,7 @@ GameActions::Result ParkSetLoanAction::Execute() const
|
|||
gameState.Cash -= (gameState.BankLoan - _value);
|
||||
gameState.BankLoan = _value;
|
||||
|
||||
auto windowManager = OpenRCT2::GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = OpenRCT2::Ui::GetWindowManager();
|
||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_UPDATE_CASH));
|
||||
return GameActions::Result();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ GameActions::Result ParkSetResearchFundingAction::Execute() const
|
|||
gameState.ResearchPriorities = _priorities;
|
||||
gameState.ResearchFundingLevel = _fundingAmount;
|
||||
|
||||
auto windowManager = OpenRCT2::GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = OpenRCT2::Ui::GetWindowManager();
|
||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_UPDATE_RESEARCH));
|
||||
return GameActions::Result();
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ GameActions::Result RideDemolishAction::DemolishRide(Ride& ride) const
|
|||
WindowCloseByClass(WindowClass::NewCampaign);
|
||||
|
||||
// Refresh windows that display the ride name
|
||||
auto windowManager = OpenRCT2::GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = OpenRCT2::Ui::GetWindowManager();
|
||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_CAMPAIGN_RIDE_LIST));
|
||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_RIDE_LIST));
|
||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_GUEST_LIST));
|
||||
|
|
|
@ -89,7 +89,7 @@ GameActions::Result RideSetNameAction::Execute() const
|
|||
GfxInvalidateScreen();
|
||||
|
||||
// Refresh windows that display ride name
|
||||
auto windowManager = OpenRCT2::GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = OpenRCT2::Ui::GetWindowManager();
|
||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_CAMPAIGN_RIDE_LIST));
|
||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_RIDE_LIST));
|
||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_GUEST_LIST));
|
||||
|
|
|
@ -202,7 +202,7 @@ GameActions::Result RideSetStatusAction::Execute() const
|
|||
|
||||
// Fix #3183: Make sure we close the construction window so the ride finishes any editing code before opening
|
||||
// otherwise vehicles get added to the ride incorrectly (such as to a ghost station)
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
WindowBase* constructionWindow = windowMgr->FindByNumber(WindowClass::RideConstruction, _rideIndex.ToUnderlying());
|
||||
if (constructionWindow != nullptr)
|
||||
{
|
||||
|
@ -243,7 +243,7 @@ GameActions::Result RideSetStatusAction::Execute() const
|
|||
Guard::Assert(false, "Invalid ride status %u", _status);
|
||||
break;
|
||||
}
|
||||
auto windowManager = OpenRCT2::GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = OpenRCT2::Ui::GetWindowManager();
|
||||
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_CAMPAIGN_RIDE_LIST));
|
||||
|
||||
return res;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue