From 3ddb52d9c15cff4d96be28fcde683145538f7fd0 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 03:47:55 +0000 Subject: [PATCH] Decompile 2 functions in Source/UI/MiniPartyPlacement.cpp, Source/UI/MiniPartyUsableArea.cpp, ... Batch #11595 by cremane: 1 byte-identical, 1 confirmed by peer review. - fn_07657 CMiniPartyWndAreaMgr::FindFreeCell: logic confirmed by peer review - fn_17166 UIWindowMgr::GetMiniPartyUsableArea: byte-identical 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/MiniPartyPlacement.cpp | 22 +++++++++++----------- Source/UI/MiniPartyUsableArea.cpp | 12 +++++++----- Source/UI/Window/UIWindowMgr.h | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Source/UI/MiniPartyPlacement.cpp b/Source/UI/MiniPartyPlacement.cpp index a8024f43..46b54d2d 100644 --- a/Source/UI/MiniPartyPlacement.cpp +++ b/Source/UI/MiniPartyPlacement.cpp @@ -42,19 +42,19 @@ UIWindow* UIWindowMgr::FindSnapExcludedWindow(int cell) { // OFFSET: 0x00737B00 // FUNCTION: fn_07657 int CMiniPartyWndAreaMgr::FindFreeCell() { - RECT usable; - g_windowMgr.GetMiniPartyUsableArea(&usable); - CMiniPartyWndSortArea area(usable); + CMiniPartyWndSortArea area(g_windowMgr.GetMiniPartyUsableArea()); const std::list cells = area.GetCells(); - for (int id : this->available) { - for (int cell : cells) { - if (cell == id) { - if (g_windowMgr.FindSnapExcludedWindow(id) == nullptr) { - return id; - } - break; - } + for (std::vector::iterator it = this->available.begin(); it != this->available.end(); ++it) { + const std::list::const_iterator found = std::find(cells.begin(), cells.end(), *it); + + if (found == cells.end()) { + continue; + } + + const UIWindow* const window = g_windowMgr.FindSnapExcludedWindow(*it); + if (window == nullptr) { + return *it; } } diff --git a/Source/UI/MiniPartyUsableArea.cpp b/Source/UI/MiniPartyUsableArea.cpp index 82d95528..918ea532 100644 --- a/Source/UI/MiniPartyUsableArea.cpp +++ b/Source/UI/MiniPartyUsableArea.cpp @@ -4,15 +4,17 @@ // OFFSET: 0x00A918B0 // FUNCTION: fn_17166 -void UIWindowMgr::GetMiniPartyUsableArea(RECT* area) { +RECT UIWindowMgr::GetMiniPartyUsableArea() { const int height = this->unknown_0480; int top = static_cast(height * 0.3f); if (UIWindow* window = g_windowMgr.LookupWindow(307)) { top = window->geometry.height; } - area->right = this->unknown_047C; - area->top = top; - area->left = 0; - area->bottom = height - g_miniPartyCellHeight * 3; + RECT area; + area.right = this->unknown_047C; + area.top = top; + area.left = 0; + area.bottom = height - g_miniPartyCellHeight * 3; + return area; } diff --git a/Source/UI/Window/UIWindowMgr.h b/Source/UI/Window/UIWindowMgr.h index 98b96cf6..b6b48a1e 100644 --- a/Source/UI/Window/UIWindowMgr.h +++ b/Source/UI/Window/UIWindowMgr.h @@ -473,7 +473,7 @@ public: UIWindow* EnsureWindow(int id); UIWindow* sub_A978D0(int id); UIWindow* CreateLayoutWindow(int id); - void GetMiniPartyUsableArea(RECT* area); + RECT GetMiniPartyUsableArea(); UIWindow* FindSnapExcludedWindow(int cell); void Schedule(UIWindow* window); __declspec(noinline) void AddRendered(UIWindow* window);