From 5749466e007ea4615c1a58cd7a67ba31d49142c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Fri, 23 May 2025 18:22:40 +0300 Subject: [PATCH] Don't copy the widget, use reference --- src/openrct2-ui/windows/GameBottomToolbar.cpp | 6 +++--- src/openrct2-ui/windows/Guest.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index dd04fe9135..e1a0dd6be0 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -612,9 +612,9 @@ namespace OpenRCT2::Ui::Windows void OnDraw(RenderTarget& rt) override { - auto leftWidget = widgets[WIDX_LEFT_OUTSET]; - auto rightWidget = widgets[WIDX_RIGHT_OUTSET]; - auto middleWidget = widgets[WIDX_MIDDLE_OUTSET]; + const auto& leftWidget = widgets[WIDX_LEFT_OUTSET]; + const auto& rightWidget = widgets[WIDX_RIGHT_OUTSET]; + const auto& middleWidget = widgets[WIDX_MIDDLE_OUTSET]; // Draw panel grey backgrounds auto leftTop = windowPos + ScreenCoordsXY{ leftWidget.left, leftWidget.top }; diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 8a74878262..b5946b43e9 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -619,9 +619,9 @@ namespace OpenRCT2::Ui::Windows if (viewport != nullptr) { - auto widget = widgets[WIDX_VIEWPORT]; - auto reqViewportWidth = widget.width() - 1; - auto reqViewportHeight = widget.height() - 1; + const auto& widget = widgets[WIDX_VIEWPORT]; + const auto reqViewportWidth = widget.width() - 1; + const auto reqViewportHeight = widget.height() - 1; viewport->pos = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; if (viewport->width != reqViewportWidth || viewport->height != reqViewportHeight) {