1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-02-01 11:15:13 +01:00

Move WindowFind functions into WindowManager (#23517)

* Move WindowFind* functions into WindowManager

* Update parameter documentation where applicable
This commit is contained in:
Aaron van Geffen
2025-01-08 21:12:11 +01:00
committed by GitHub
parent a8ef595248
commit aa45247f21
58 changed files with 657 additions and 354 deletions

View File

@@ -12,7 +12,10 @@
#include "Window.h"
#include <algorithm>
#include <openrct2/Context.h>
#include <openrct2/core/Numerics.hpp>
#include <openrct2/ui/UiContext.h>
#include <openrct2/ui/WindowManager.h>
#include <openrct2/world/Map.h>
#include <openrct2/world/tile_element/EntranceElement.h>
#include <openrct2/world/tile_element/PathElement.h>
@@ -36,7 +39,8 @@ namespace OpenRCT2::Ui
*/
CoordsXY FootpathGetCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32_t* direction, TileElement** tileElement)
{
WindowBase* window = WindowFindFromPoint(screenCoords);
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
if (window == nullptr || window->viewport == nullptr)
{
CoordsXY position{};
@@ -134,7 +138,8 @@ 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.
WindowBase* window = WindowFindFromPoint(screenCoords);
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
if (window == nullptr || window->viewport == nullptr)
{
CoordsXY ret{};