From 51503bd9e128eb3e76169ef4780842fcf30f82e2 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 19:20:53 +0000 Subject: [PATCH] Decompile fn_10041 (RodexMailEntryLess::operator()) Batch #6052 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_10041 RodexMailEntryLess::operator(): logic confirmed by peer review Peer-reviewed-by: Lumen, superintelligence, Snow Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Rodex/UIRodexInboxWnd.cpp | 29 +++++++++++++++++++++++++++++ Source/UI/Rodex/UIRodexInboxWnd.h | 28 +--------------------------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/Source/UI/Rodex/UIRodexInboxWnd.cpp b/Source/UI/Rodex/UIRodexInboxWnd.cpp index 706e90aa1..c30de4d4a 100644 --- a/Source/UI/Rodex/UIRodexInboxWnd.cpp +++ b/Source/UI/Rodex/UIRodexInboxWnd.cpp @@ -265,3 +265,32 @@ void UIRodexInboxWnd::InitializeMailActions() { this->unknown_0190->SetId(0x224); this->Invalidate(); } + +// OFFSET: 0x00805350 +// FUNCTION: fn_10041 +bool RodexMailEntryLess::operator()(const RodexMailEntry& left, const RodexMailEntry& right) const { + std::map* leftMails = RodexMailsOfType(left.first); + if (!leftMails) { + return false; + } + std::map::iterator leftMail = leftMails->find(left.second); + if (leftMail == leftMails->end()) { + return false; + } + std::map* rightMails = RodexMailsOfType(right.first); + if (!rightMails) { + return false; + } + std::map::iterator rightMail = rightMails->find(right.second); + if (rightMail == rightMails->end()) { + return false; + } + if (leftMail->second.isRead == 0) { + if (rightMail->second.isRead == 1) { + return true; + } + } else if (rightMail->second.isRead == 0) { + return false; + } + return leftMail->second.unknown_001C > rightMail->second.unknown_001C; +} diff --git a/Source/UI/Rodex/UIRodexInboxWnd.h b/Source/UI/Rodex/UIRodexInboxWnd.h index c34716b2e..657e1c352 100644 --- a/Source/UI/Rodex/UIRodexInboxWnd.h +++ b/Source/UI/Rodex/UIRodexInboxWnd.h @@ -34,33 +34,7 @@ inline std::map* RodexMailsOfType(int type) { } struct RodexMailEntryLess { - // INLINED - bool operator()(const RodexMailEntry& left, const RodexMailEntry& right) const { - std::map* leftMails = RodexMailsOfType(left.first); - if (!leftMails) { - return false; - } - std::map::iterator leftMail = leftMails->find(left.second); - if (leftMail == leftMails->end()) { - return false; - } - std::map* rightMails = RodexMailsOfType(right.first); - if (!rightMails) { - return false; - } - std::map::iterator rightMail = rightMails->find(right.second); - if (rightMail == rightMails->end()) { - return false; - } - if (leftMail->second.isRead == 0) { - if (rightMail->second.isRead == 1) { - return true; - } - } else if (rightMail->second.isRead == 0) { - return false; - } - return leftMail->second.unknown_001C > rightMail->second.unknown_001C; - } + bool operator()(const RodexMailEntry& left, const RodexMailEntry& right) const; }; class UIRodexInboxWnd : public UIItemWnd {