1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 23:34:37 +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

@@ -1725,7 +1725,8 @@ InteractionInfo SetInteractionInfoFromPaintSession(PaintSession* session, uint32
*/
InteractionInfo GetMapCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32_t flags)
{
WindowBase* window = WindowFindFromPoint(screenCoords);
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
return GetMapCoordinatesFromPosWindow(window, screenCoords, flags);
}
@@ -1813,7 +1814,8 @@ void ViewportInvalidate(const Viewport* viewport, const ScreenRect& screenRect)
static Viewport* ViewportFindFromPoint(const ScreenCoordsXY& screenCoords)
{
WindowBase* w = WindowFindFromPoint(screenCoords);
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
WindowBase* w = windowMgr->FindFromPoint(screenCoords);
if (w == nullptr)
return nullptr;
@@ -1841,8 +1843,10 @@ static Viewport* ViewportFindFromPoint(const ScreenCoordsXY& screenCoords)
*/
std::optional<CoordsXY> ScreenGetMapXY(const ScreenCoordsXY& screenCoords, Viewport** viewport)
{
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
// This will get the tile location but we will need the more accuracy
WindowBase* window = WindowFindFromPoint(screenCoords);
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
if (window == nullptr || window->viewport == nullptr)
{
return std::nullopt;