From 1526bc8ecbc80ddb4080631c92603f7a1fc0c8a5 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 4 Nov 2026 18:47:27 +0000 Subject: [PATCH] Decompile fn_09720 (CSnapMgr::Clear) Batch #11020 by cremane: 1 byte-identical, 0 confirmed by peer review. - fn_09720 CSnapMgr::Clear: byte-identical Merged automatically: every function is byte-identical to the original. --- Source/UI/Layout/SnapMgr.cpp | 60 ++++++++++++++++++----------------- Source/UI/Layout/SnapMgr.h | 1 - Source/UI/Layout/SnapObject.h | 1 + 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/Source/UI/Layout/SnapMgr.cpp b/Source/UI/Layout/SnapMgr.cpp index 099575e3..16c82c28 100644 --- a/Source/UI/Layout/SnapMgr.cpp +++ b/Source/UI/Layout/SnapMgr.cpp @@ -29,8 +29,8 @@ namespace { return true; } - for (SnapObject* next : object->edges[1]) { - if (ContainsUpward(next, target)) { + for (auto next = object->edges[1].begin(); next != object->edges[1].end(); ++next) { + if (ContainsUpward(*next, target)) { return true; } } @@ -135,7 +135,8 @@ bool CSnapMgr::ConnectedToRoot(UIWindow* window) { // OFFSET: 0x007E34C0 // FUNCTION: fn_09719 void CSnapMgr::UpdateLinks(SnapObject* object) { - for (SnapObject* existing : this->objects) { + for (auto entry = this->objects.begin(); entry != this->objects.end(); ++entry) { + SnapObject* existing = *entry; const int side = object->AdjacentSide(*existing); object->Remove(existing); existing->Remove(object); @@ -157,8 +158,8 @@ void CSnapMgr::Refresh(UIWindow* window) { return; } - for (SnapObject* object : this->objects) { - this->UpdateLinks(object); + for (auto entry = this->objects.begin(); entry != this->objects.end(); ++entry) { + this->UpdateLinks(*entry); } } @@ -169,9 +170,9 @@ void CSnapMgr::CaptureOrigins(UIWindow* window) { return; } - for (SnapObject* object : this->objects) { - if (object->window && this->ConnectedToRoot(object->window)) { - object->window->Slot12(); + for (auto entry = this->objects.begin(); entry != this->objects.end(); ++entry) { + if ((*entry)->window && this->ConnectedToRoot((*entry)->window)) { + (*entry)->window->Slot12(); } } } @@ -185,8 +186,8 @@ void CSnapMgr::ConstrainGroup(UIWindow* window, int& dx, int& dy) { int resultX = 0, resultY = 0; if (this->root->window == window) { - for (SnapObject* object : this->objects) { - UIWindow* member = object->window; + for (auto entry = this->objects.begin(); entry != this->objects.end(); ++entry) { + UIWindow* member = (*entry)->window; if (!this->ConnectedToRoot(member)) { continue; } @@ -218,30 +219,31 @@ void CSnapMgr::MoveConnected(UIWindow* window, int dx, int dy) { return; } - for (SnapObject* object : this->objects) { - if (this->ConnectedToRoot(object->window)) { - object->window->Slot13(dx, dy); - g_windowMgr.StoreSnapRectangle(object->window); + for (auto entry = this->objects.begin(); entry != this->objects.end(); ++entry) { + UIWindow* member = (*entry)->window; + if (this->ConnectedToRoot(member)) { + member->Slot13(dx, dy); + g_windowMgr.StoreSnapRectangle(member); } } } // OFFSET: 0x007E31C0 // FUNCTION: fn_09717 -void CSnapMgr::MoveBranch(SnapObject* object, int dx, int dy, int side) { - if (side == -1 || object->visited == 1) { +void SnapObject::MoveBranch(int dx, int dy, int side) { + if (side == -1 || this->visited == 1) { return; } - object->visited = 1; - if (object->window) { - object->window->geometry.x = (object->window->geometry.x + dx); - object->window->geometry.y = (object->window->geometry.y + dy); - g_windowMgr.StoreSnapRectangle(object->window); + this->visited = 1; + if (this->window) { + this->window->geometry.x = (this->window->geometry.x + dx); + this->window->geometry.y = (this->window->geometry.y + dy); + g_windowMgr.StoreSnapRectangle(this->window); } - for (SnapObject* next : object->edges[side]) { - MoveBranch(next, dx, dy, side); + for (auto next = this->edges[side].begin(); next != this->edges[side].end(); ++next) { + (*next)->MoveBranch(dx, dy, side); } } @@ -302,8 +304,8 @@ void CSnapMgr::MoveEdge(UIWindow* window, int dx, int dy, int side) { } } - for (SnapObject* next : object->edges[side]) { - MoveBranch(next, dx, dy, side); + for (auto next = object->edges[side].begin(); next != object->edges[side].end(); ++next) { + (*next)->MoveBranch(dx, dy, side); } } @@ -313,8 +315,8 @@ void CSnapMgr::MoveEdge(UIWindow* window, int dx, int dy, int side) { // OFFSET: 0x007E3600 // FUNCTION: fn_09720 void CSnapMgr::Clear() { - for (SnapObject* object : this->objects) { - delete object; + for (auto entry = this->objects.begin(); entry != this->objects.end(); ++entry) { + delete *entry; } this->objects.clear(); @@ -337,8 +339,8 @@ void CSnapMgr::Remove(UIWindow* window) { delete object; this->objects.erase(entry); - for (SnapObject* remaining : this->objects) { - remaining->Remove(object); + for (auto remaining = this->objects.begin(); remaining != this->objects.end(); ++remaining) { + (*remaining)->Remove(object); } return; diff --git a/Source/UI/Layout/SnapMgr.h b/Source/UI/Layout/SnapMgr.h index 75c3e7ea..a6d32196 100644 --- a/Source/UI/Layout/SnapMgr.h +++ b/Source/UI/Layout/SnapMgr.h @@ -31,7 +31,6 @@ public: private: void ResetVisited(); SnapObject* Find(const UIWindow* window) const; - static void MoveBranch(SnapObject* object, int dx, int dy, int side); CSnapMgr(const CSnapMgr&) = delete; CSnapMgr& operator=(const CSnapMgr&) = delete; }; diff --git a/Source/UI/Layout/SnapObject.h b/Source/UI/Layout/SnapObject.h index 7cbbbf19..995344e4 100644 --- a/Source/UI/Layout/SnapObject.h +++ b/Source/UI/Layout/SnapObject.h @@ -15,6 +15,7 @@ public: bool Connected(SnapObject* target); int GetHeight() const; void AccumulateHeight(int& height, int side) const; + void MoveBranch(int dx, int dy, int side); /* 0004 */ UIWindow* window; /* 0008 */ std::list edges[4];