mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-22 22:34:33 +01: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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user