From 86248ce8aaffa02cf2e2a704e89dd9e220f8156c Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 20:33:13 +0000 Subject: [PATCH] Confirm fn_03776 (CExpandedBarterMarketItemMgr::Clear) Batch #16510 by eAthena: 1 byte-identical, 0 confirmed by peer review. - fn_03776 CExpandedBarterMarketItemMgr::Clear: byte-identical (already on main) Merged automatically: every function is byte-identical to the original. --- Source/Contents/Items/BarterMarketItemMgr.cpp | 5 ++- Source/Contents/Items/BarterMarketItemMgr.h | 10 +++-- Source/UI/UIBartermarketWnd.cpp | 44 ++++++++++--------- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/Source/Contents/Items/BarterMarketItemMgr.cpp b/Source/Contents/Items/BarterMarketItemMgr.cpp index 7edcd2a38..459e0d185 100644 --- a/Source/Contents/Items/BarterMarketItemMgr.cpp +++ b/Source/Contents/Items/BarterMarketItemMgr.cpp @@ -516,8 +516,9 @@ bool CExpandedBarterMarketItemMgr::HasEntryByName(std::string name) { bool found = false; std::find_if(this->entries.begin(), this->entries.end(), [name, &found](BarterMarketEntry entry) { - found = name == entry.name; - return found; + const bool equal = name == entry.name; + found = equal; + return equal; }); return found; } diff --git a/Source/Contents/Items/BarterMarketItemMgr.h b/Source/Contents/Items/BarterMarketItemMgr.h index 18776f810..cf7c22ce6 100644 --- a/Source/Contents/Items/BarterMarketItemMgr.h +++ b/Source/Contents/Items/BarterMarketItemMgr.h @@ -66,10 +66,10 @@ public: static_assert(sizeof(CBarterMarketItemMgr) == 0x20); struct BarterChunk16 { - /* 0000 */ int field_0; - /* 0004 */ int field_4; - /* 0008 */ int amount; - /* 000C */ int field_c; + /* 0000 */ int field_0 = 0; + /* 0004 */ int field_4 = 0; + /* 0008 */ int amount = 0; + /* 000C */ int field_c = 0; }; struct BarterMarketEntry { @@ -98,6 +98,8 @@ struct BarterMarketEntry { // FUNCTION: fn_10571 BarterMarketEntry& operator=(const BarterMarketEntry& other) = default; + __declspec(noinline) ~BarterMarketEntry() = default; + ITEM_INFO ToItemInfo() const; }; diff --git a/Source/UI/UIBartermarketWnd.cpp b/Source/UI/UIBartermarketWnd.cpp index a66dd30fa..2a9746d9b 100644 --- a/Source/UI/UIBartermarketWnd.cpp +++ b/Source/UI/UIBartermarketWnd.cpp @@ -267,7 +267,7 @@ void UIExpandedBartermarketWnd::DragAndDrop(int x, int y, std::intptr_t value) { // FUNCTION: fn_10578 std::pair UIExpandedBarterItemPurchaseWnd::GetEntryAt(int x, int y) { if (x < 40 || x >= this->geometry.width - 20 || y < 17 || y >= this->rowCount * 64 + 17) { - return std::pair(false, BarterMarketEntry()); + return std::make_pair(false, BarterMarketEntry()); } const int row = (y - 17) / 64; @@ -276,19 +276,19 @@ std::pair UIExpandedBarterItemPurchaseWnd::GetEntryAt(i for (std::list::iterator it = this->entries.begin(); it != this->entries.end(); ++it, ++index) { if (index >= this->firstRow) { if (visible == row) { - return std::pair(true, *it); + return std::make_pair(true, *it); } ++visible; } } - return std::pair(false, BarterMarketEntry()); + return std::make_pair(false, BarterMarketEntry()); } // OFFSET: 0x00846110 // FUNCTION: fn_10579 std::pair UIExpandedBartermarketWnd::GetEntryAt(int x, int y) { if (x < 40 || x >= this->geometry.width - 20 || y < 17 || y >= this->rowCount * 64 + 17) { - return std::pair(false, BarterMarketEntry()); + return std::make_pair(false, BarterMarketEntry()); } int index = 0; @@ -296,12 +296,12 @@ std::pair UIExpandedBartermarketWnd::GetEntryAt(int x, for (std::list::iterator it = this->entries.begin(); it != this->entries.end(); ++it, ++index) { if (index >= this->firstRow) { if (visible == (y - 17) / 64) { - return std::pair(true, *it); + return std::make_pair(true, *it); } ++visible; } } - return std::pair(false, BarterMarketEntry()); + return std::make_pair(false, BarterMarketEntry()); } // OFFSET: 0x008462C0 @@ -347,7 +347,7 @@ std::pair UIExpandedBarterItemPurchaseWnd::GetEntryOrCh // FUNCTION: fn_10581 std::pair UIExpandedBartermarketWnd::GetEntryOrChunkAt(int x, int y) { if (x < 40 || x >= this->geometry.width - 20 || y < 17 || y >= this->rowCount * 64 + 17) { - return std::pair(false, BarterMarketEntry()); + return std::make_pair(false, BarterMarketEntry()); } const int offsetY = y - 17; @@ -366,20 +366,20 @@ std::pair UIExpandedBartermarketWnd::GetEntryOrChunkAt( char buffer[16] = {}; entry.name = _itoa(chunk->field_0, buffer, 10); entry.field_0 = chunk->field_c; - return std::pair(true, entry); + return std::make_pair(true, entry); } right += 42; } } if (x > 40 && x < 72) { entry = *it; - return std::pair(true, entry); + return std::make_pair(true, entry); } } ++visible; } } - return std::pair(false, BarterMarketEntry()); + return std::make_pair(false, BarterMarketEntry()); } // OFFSET: 0x00849030 @@ -502,8 +502,14 @@ int UIExpandedBarterItemPurchaseWnd::SendMsg(UIWindow* sender, int message, std: found.second.value = mode->drag.quantity; for (std::vector::iterator chunk = found.second.chunks.begin(); chunk != found.second.chunks.end(); ++chunk) { ITEM_INFO owned = LookupClientItemByIdentity(g_session.m_inventoryItems, chunk->field_0); - bool missing = owned.identity[1] > 0; - if (!missing && g_session.HasItemCount(chunk->field_0, chunk->field_4) == true) { + if (owned.identity[1] > 0) { + mode->SendMsg(MM_CANCEL_DRAG, 0, 0, 0, 0); + g_windowMgr.SendNotice(UIM_OPENCHATWND, 0, 0, 0, 0, 0); + g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast(LookupMessage(MSI_MONSTER_MONSTERINFO)), 255, 0, 0, 0); + return 0; + } + + if (g_session.HasItemCount(chunk->field_0, chunk->field_4) == true) { const int itemId = chunk->field_0; const int refine = chunk->field_4; const int count = g_session.GetList0Size(); @@ -515,14 +521,12 @@ int UIExpandedBarterItemPurchaseWnd::SendMsg(UIWindow* sender, int message, std: break; } } - missing = available <= 0; - } - - if (missing) { - mode->SendMsg(MM_CANCEL_DRAG, 0, 0, 0, 0); - g_windowMgr.SendNotice(UIM_OPENCHATWND, 0, 0, 0, 0, 0); - g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast(LookupMessage(MSI_MONSTER_MONSTERINFO)), 255, 0, 0, 0); - return 0; + if (available <= 0) { + mode->SendMsg(MM_CANCEL_DRAG, 0, 0, 0, 0); + g_windowMgr.SendNotice(UIM_OPENCHATWND, 0, 0, 0, 0, 0); + g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast(LookupMessage(MSI_MONSTER_MONSTERINFO)), 255, 0, 0, 0); + return 0; + } } }