From 8417d5b024cfc641bde9d912807f16f1cbce2acc Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Mon, 9 Nov 2026 07:58:39 +0000 Subject: [PATCH] Decompile fn_16125 (CUIListBoxEx::OnScroll) Batch #15053 by Yommy: 1 byte-identical, 0 confirmed by peer review. - fn_16125 CUIListBoxEx::OnScroll: byte-identical Merged automatically: every function is byte-identical to the original. --- .../ProbabilityTable/UIProbabilityTable.cpp | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Source/UI/ProbabilityTable/UIProbabilityTable.cpp b/Source/UI/ProbabilityTable/UIProbabilityTable.cpp index 2a9a844d4..3a7676a86 100644 --- a/Source/UI/ProbabilityTable/UIProbabilityTable.cpp +++ b/Source/UI/ProbabilityTable/UIProbabilityTable.cpp @@ -363,33 +363,34 @@ void CUIListBoxEx::OnWhe // FUNCTION: fn_16125 template <> void CUIListBoxEx::OnScroll(int position) { - auto it = this->items.begin(); - if (it == this->items.end()) { + if (this->items.empty()) { return; } if (this->data.size() == 0) { - for (; it != this->items.end(); ++it) { - (*it)->index = -1; - (*it)->Show(0); + for (ProbabilityTable::CUIItem* item : this->items) { + item->index = -1; + item->Show(0); } return; } - const int first = (*it)->index; + const int first = this->items.front()->index; unsigned int row = position / this->rowHeight; if (first != -1) { if (first < static_cast(row)) { - if (row - first < static_cast(this->items.size())) { - std::rotate(this->items.begin(), this->items.begin() + (row - first), this->items.end()); + const unsigned int shift = row - first; + if (shift < static_cast(this->items.size())) { + std::rotate(this->items.begin(), this->items.begin() + shift, this->items.end()); } } else if (first > static_cast(row)) { - if (first - row < static_cast(this->items.size())) { - std::rotate(this->items.begin(), this->items.end() - (first - row), this->items.end()); + const unsigned int shift = first - row; + if (shift < static_cast(this->items.size())) { + std::rotate(this->items.begin(), this->items.end() - shift, this->items.end()); } } } - it = this->items.begin(); + auto it = this->items.begin(); for (int y = this->itemY - position % this->rowHeight; y < this->geometry.height; y += this->rowHeight, ++it, ++row) { if (it == this->items.end() || row >= this->data.size()) { break; @@ -410,9 +411,10 @@ void CUIListBoxEx::OnScr } } - for (; it != this->items.end(); ++it) { - (*it)->index = -1; - (*it)->Show(0); + for (auto end = this->items.end(); it != end; ++it) { + ProbabilityTable::CUIItem* item = *it; + item->index = -1; + item->Show(0); } }