From 0098d2bfd9c001378beecb0ec64f0f3cb22c577c Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 04:30:18 +0000 Subject: [PATCH] Decompile fn_17161 (UIWindowMgr::ConstrainSnap) Batch #11722 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_17161 UIWindowMgr::ConstrainSnap: logic confirmed by peer review Peer-reviewed-by: Yommy, KWDev Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Layout/WindowSnapping.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/UI/Layout/WindowSnapping.cpp b/Source/UI/Layout/WindowSnapping.cpp index 0496ea27..0132a9ff 100644 --- a/Source/UI/Layout/WindowSnapping.cpp +++ b/Source/UI/Layout/WindowSnapping.cpp @@ -48,9 +48,11 @@ void UIWindowMgr::ConstrainSnap(UIWindow* window, int& dx, int& dy, int groupMem return; } + int snapX = 0, snapY = 0; const bool root = g_snapMgr.IsRoot(window); - for (auto& [other, rectangle] : this->snapRectangles) { + for (auto it = this->snapRectangles.begin(); it != this->snapRectangles.end(); ++it) { + auto& [other, rectangle] = *it; const bool connected = g_snapMgr.Connected(window, other); const bool otherRoot = g_snapMgr.IsRoot(other); const bool otherConnected = g_snapMgr.ConnectedToRoot(other); @@ -65,15 +67,15 @@ void UIWindowMgr::ConstrainSnap(UIWindow* window, int& dx, int& dy, int groupMem } } - rectangle.Snap(moving, x, y); - if (x != 0 && needX) { + rectangle.Snap(moving, snapX, snapY); + if (snapX != 0 && needX) { needX = false; - dx = x; + dx = snapX; } - if (y != 0 && needY) { + if (snapY != 0 && needY) { needY = false; - dy = y; + dy = snapY; } if (!needX && !needY) {