From 9f0125b509012c4fc6ea9b68b33f0c7d28954ff9 Mon Sep 17 00:00:00 2001 From: mrmbernardi Date: Tue, 6 Aug 2024 02:29:21 +1000 Subject: [PATCH] Fix finance graph maximum finding algorithm. (#22488) --- src/openrct2-ui/windows/Finances.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 8de32b5e0677..149e7c0cef3a 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -859,10 +859,10 @@ static Widget _windowFinancesResearchWidgets[] = money64 maxVal = 0; for (int32_t i = 0; i < kGraphNumPoints; i++) { - auto val = series[i]; + auto val = std::abs(series[i]); if (val == kMoney64Undefined) continue; - while (std::abs(val) > maxVal) + if (val > maxVal) maxVal = val; } // This algorithm increments the leading digit of the max and sets all other digits to zero.