From 0e1fdd7d5ea5fa7bd3ad5da52cbba48eb8a4e628 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 03:55:10 +0000 Subject: [PATCH] Decompile fn_04265 (CPlayerNameDictionary::Update) Batch #11617 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_04265 CPlayerNameDictionary::Update: 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/Contents/PlayerNameDictionary.cpp | 35 ++++++++++++------------ 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/Source/Contents/PlayerNameDictionary.cpp b/Source/Contents/PlayerNameDictionary.cpp index ae4c3e2a..a9af8c6f 100644 --- a/Source/Contents/PlayerNameDictionary.cpp +++ b/Source/Contents/PlayerNameDictionary.cpp @@ -69,24 +69,25 @@ void CPlayerNameDictionary::Update() { while (!this->m_pending.empty()) { const std::uint32_t id = this->m_pending.front(); const auto cached = this->m_names.find(id); - const bool fresh = cached != this->m_names.end() && !(cached->second.tick + 600000u < timeGetTime()); - const auto outstanding = std::find_if(this->m_requests.begin(), this->m_requests.end(), [&](const Request& request) { return request.id == id; }); + if (cached == this->m_names.end() || cached->second.IsExpired()) { + const auto outstanding = std::find_if(this->m_requests.begin(), this->m_requests.end(), [&](const Request& request) { return request.id == id; }); + if (outstanding == this->m_requests.end()) { + this->m_pending.pop_front(); + + if (id != 0) { + unsigned char packet[6]; + const std::uint16_t header = 873; + std::memcpy(packet, &header, sizeof(header)); + std::memcpy(packet + 2, &id, sizeof(id)); + GetRagConnection().Send(sizeof(packet), packet); + this->m_requests.push_back({id, timeGetTime()}); + } + + return; + } + } + this->m_pending.pop_front(); - - if (fresh || outstanding != this->m_requests.end()) { - continue; - } - - if (id != 0) { - unsigned char packet[6]; - const std::uint16_t header = 873; - std::memcpy(packet, &header, sizeof(header)); - std::memcpy(packet + 2, &id, sizeof(id)); - GetRagConnection().Send(sizeof(packet), packet); - this->m_requests.push_back({id, timeGetTime()}); - } - - return; } }