From bf3183b6380af1df380eae1c4ee5c74fb032ed41 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 6 Nov 2026 22:11:20 +0000 Subject: [PATCH] Decompile fn_10522 (UITagTextViewer::Clear) Batch #13809 by eAthena: 1 byte-identical, 0 confirmed by peer review. - fn_10522 UITagTextViewer::Clear: byte-identical Merged automatically: every function is byte-identical to the original. --- Source/UI/Text/UITagTextViewer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/UI/Text/UITagTextViewer.cpp b/Source/UI/Text/UITagTextViewer.cpp index ff1aca28f..4c15151d7 100644 --- a/Source/UI/Text/UITagTextViewer.cpp +++ b/Source/UI/Text/UITagTextViewer.cpp @@ -28,7 +28,8 @@ void TagTextViewer::UIScroll::StorePosition(UIWindow* child) { // OFFSET: 0x0083ECF0 // FUNCTION: fn_10522 void UITagTextViewer::Clear() { - for (std::map::iterator it = this->m_positions.begin(); it != this->m_positions.end(); ++it) { + const auto end = this->m_positions.end(); + for (auto it = this->m_positions.begin(); it != end; ++it) { this->RemoveChild(it->first, 1); } @@ -45,7 +46,7 @@ void UITagTextViewer::Clear() { int TagTextViewer::UIScroll::ContentHeight() { int height = 0; - for (std::map::iterator it = this->m_positions.begin(); it != this->m_positions.end(); ++it) { + for (std::map::const_iterator it = this->m_positions.cbegin(); it != this->m_positions.cend(); ++it) { height = static_cast(std::max(static_cast(height), static_cast(it->first->geometry.height) + it->second.y)); } @@ -101,7 +102,9 @@ void TagTextViewer::UIScroll::UpdateScroll() { if (height > this->geometry.height) { this->m_scrollBar->Show(1); this->m_scrollBar->SetRange(height - this->geometry.height, this->geometry.height, height); - this->m_scrollPos = std::min(std::max(0, this->m_scrollPos), height - this->geometry.height); + const int position = this->m_scrollPos > 0 ? this->m_scrollPos : 0; + const int range = height - this->geometry.height; + this->m_scrollPos = position < range ? position : range; this->m_scrollBar->SetPosition(this->m_scrollPos); for (std::map::iterator it = this->m_positions.begin(); it != this->m_positions.end(); ++it) { it->first->Move(static_cast(it->second.x), static_cast(it->second.y - static_cast(this->m_scrollPos)));