From 677f6c0717779f101632b63df1084ca353fb4f06 Mon Sep 17 00:00:00 2001 From: mix Date: Wed, 27 Aug 2025 09:13:05 +0100 Subject: [PATCH] Remove unused function WindowViewportCentreTileAroundCursor --- src/openrct2/interface/Window.cpp | 24 ------------------------ src/openrct2/interface/Window.h | 1 - 2 files changed, 25 deletions(-) diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 0e2ca2c856..956ec265ec 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -411,30 +411,6 @@ static constexpr float kWindowScrollLocations[][2] = { } } - void WindowViewportCentreTileAroundCursor(WindowBase& w, int32_t map_x, int32_t map_y, int32_t offset_x, int32_t offset_y) - { - // Get viewport coordinates centring around the tile. - int32_t z = TileElementHeight({ map_x, map_y }); - auto centreLoc = centre_2d_coordinates({ map_x, map_y, z }, w.viewport); - - if (!centreLoc.has_value()) - { - LOG_ERROR("Invalid location."); - return; - } - - // Get mouse position to offset against. - auto mouseCoords = ContextGetCursorPositionScaled(); - - // Rebase mouse position onto centre of window, and compensate for zoom level. - int32_t rebased_x = w.viewport->zoom.ApplyTo((w.width >> 1) - mouseCoords.x); - int32_t rebased_y = w.viewport->zoom.ApplyTo((w.height >> 1) - mouseCoords.y); - - // Apply offset to the viewport. - w.savedViewPos = { centreLoc->x + rebased_x + w.viewport->zoom.ApplyInversedTo(offset_x), - centreLoc->y + rebased_y + w.viewport->zoom.ApplyInversedTo(offset_y) }; - } - /** * For all windows with viewports, ensure they do not have a zoom level less than the minimum. */ diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index b5608b393c..8c896b3e13 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -306,7 +306,6 @@ namespace OpenRCT2 WindowBase* WindowGetMain(); void WindowScrollToLocation(WindowBase& w, const CoordsXYZ& coords); - void WindowViewportCentreTileAroundCursor(WindowBase& w, int32_t map_x, int32_t map_y, int32_t offset_x, int32_t offset_y); void WindowCheckAllValidZoom(); void WindowZoomSet(WindowBase& w, ZoomLevel zoomLevel, bool atCursor);