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).
This commit is contained in:
ragnarok-clanker 2026-10-30 19:20:53 +00:00
commit 51503bd9e1
2 changed files with 30 additions and 27 deletions

View file

@ -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<std::int64_t, RodexMail>* leftMails = RodexMailsOfType(left.first);
if (!leftMails) {
return false;
}
std::map<std::int64_t, RodexMail>::iterator leftMail = leftMails->find(left.second);
if (leftMail == leftMails->end()) {
return false;
}
std::map<std::int64_t, RodexMail>* rightMails = RodexMailsOfType(right.first);
if (!rightMails) {
return false;
}
std::map<std::int64_t, RodexMail>::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;
}

View file

@ -34,33 +34,7 @@ inline std::map<std::int64_t, RodexMail>* RodexMailsOfType(int type) {
}
struct RodexMailEntryLess {
// INLINED
bool operator()(const RodexMailEntry& left, const RodexMailEntry& right) const {
std::map<std::int64_t, RodexMail>* leftMails = RodexMailsOfType(left.first);
if (!leftMails) {
return false;
}
std::map<std::int64_t, RodexMail>::iterator leftMail = leftMails->find(left.second);
if (leftMail == leftMails->end()) {
return false;
}
std::map<std::int64_t, RodexMail>* rightMails = RodexMailsOfType(right.first);
if (!rightMails) {
return false;
}
std::map<std::int64_t, RodexMail>::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 {