From dac559484ecd38d1b006405a62cb2c8b399b6b1a Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 03:42:49 +0000 Subject: [PATCH] Decompile fn_11602 (UITreeView::DeleteChildNodes) Batch #6934 by Romain: 0 byte-identical, 1 confirmed by peer review. - fn_11602 UITreeView::DeleteChildNodes: logic confirmed by peer review Peer-reviewed-by: eAthena, superintelligence, Landruca Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Lists/UIScrollBar.cpp | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/Source/UI/Lists/UIScrollBar.cpp b/Source/UI/Lists/UIScrollBar.cpp index e372f3089..fa9ccc220 100644 --- a/Source/UI/Lists/UIScrollBar.cpp +++ b/Source/UI/Lists/UIScrollBar.cpp @@ -1094,6 +1094,59 @@ int UITreeView::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::int } // OFFSET: 0x0089E570 +// FUNCTION: fn_11602 +bool UITreeView::DeleteChildNodes(UITreeNode* node) { + if (!node) { + return false; + } + + int remaining = static_cast(node->children.size()); + if (remaining <= 0) { + return false; + } + + for (auto it = node->children.begin(); it != node->children.end(); ++it) { + UITreeNode* child = *it; + if (child->children.size() != 0) { + this->DeleteChildNodes(child); + } + + if ((*it)->collapseButton) { + (*it)->collapseButton->Move(-100, -100); + (*it)->collapseButton = nullptr; + } + + if ((*it)->expandButton) { + (*it)->expandButton->Move(-100, -100); + (*it)->expandButton = nullptr; + } + + (*it)->labelButton->Move(-100, -100); + --remaining; + (*it)->labelButton = nullptr; + + if (node->children.size() == 0) { + if (node->collapseButton) { + node->collapseButton->Move(-100, -100); + node->collapseButton = nullptr; + } + + if (node->expandButton) { + node->expandButton->Move(-100, -100); + node->expandButton = nullptr; + } + } + + delete *it; + + if (remaining == 0) { + node->children.clear(); + return true; + } + } + + return true; +} // OFFSET: 0x0089E6F0 // FUNCTION: fn_11603