From 3ef7788be7eb003879159eccbc473680d6c363c9 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 03:46:03 +0000 Subject: [PATCH] Decompile fn_20939 (TreeSubMap::Clear) Batch #11590 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_20939 TreeSubMap::Clear: logic confirmed by peer review Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Script/NLuaState.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/Script/NLuaState.cpp b/Source/Script/NLuaState.cpp index 2020af50..faaf1d36 100644 --- a/Source/Script/NLuaState.cpp +++ b/Source/Script/NLuaState.cpp @@ -4,6 +4,7 @@ extern "C" { #include #include } +#include // GLOBAL: gl_24849 void* g_entryQueueMgr = nullptr; @@ -20,23 +21,22 @@ struct TreeSubMap { TreeSubNode* head; unsigned int size; - void Clear(); + void Clear() noexcept; void EraseSubtree(TreeSubMap& al, TreeSubNode* node); }; // OFFSET: 0x00CA4AE0 // FUNCTION: fn_20939 -void TreeSubMap::Clear() { - TreeSubNode* cur = this->head->parent; +void TreeSubMap::Clear() noexcept { + TreeSubNode* head = this->head; + TreeSubNode* cur = head->parent; while (cur->isnil == 0) { this->EraseSubtree(*this, cur->right); - TreeSubNode* next = cur->left; - ::operator delete(cur, 0x18); - cur = next; + ::operator delete(std::exchange(cur, cur->left), 0x18); } - this->head->parent = this->head; - this->head->left = this->head; - this->head->right = this->head; + head->parent = head; + head->left = head; + head->right = head; this->size = 0; }