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).
This commit is contained in:
parent
61b3e2ea52
commit
0e1fdd7d5e
1 changed files with 17 additions and 16 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue