From e2c01faac9bbba68650e06370509dc14d96c04b8 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 12 Nov 2026 05:01:28 +0000 Subject: [PATCH] Decompile fn_23851 (CSession::HasTrackedAchievement) Batch #17868 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_23851 CSession::HasTrackedAchievement: logic confirmed by peer review Peer-reviewed-by: Yommy, codeplay, bibinir Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Client/Session/SessionPredicates.cpp | 14 +++++++------- .../Source/Client/Session/SessionPredicates.cpp.h | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Source/Client/Session/SessionPredicates.cpp b/Source/Client/Session/SessionPredicates.cpp index fac7bfd04..07592bc83 100644 --- a/Source/Client/Session/SessionPredicates.cpp +++ b/Source/Client/Session/SessionPredicates.cpp @@ -6,9 +6,13 @@ #include "Contents/Actors/Pc.h" #include "Contents/World/World.h" +#include #include #include +template __declspec(noinline) SessionRecord6178Entry* std::allocator::allocate(std::size_t); +template __declspec(noinline) std::vector::~vector() noexcept; + // OFFSET: 0x00E1D6B0 // FUNCTION: fn_23850 int CSession::IsState291To303(int state) const { @@ -34,13 +38,9 @@ int CSession::IsState291To303(int state) const { // OFFSET: 0x00E1D700 // FUNCTION: fn_23851 bool CSession::HasTrackedAchievement(int id) const { - auto it = this->trackedAchievements.begin(); - for (; it != this->trackedAchievements.end(); ++it) { - const SessionRecord6178 record = *it; - if (id == record.id) { - break; - } - } + const auto it = std::find_if(this->trackedAchievements.begin(), this->trackedAchievements.end(), [id](SessionRecord6178 record) { + return id == record.id; + }); return it != this->trackedAchievements.end(); } diff --git a/Source/Linkage/Source/Client/Session/SessionPredicates.cpp.h b/Source/Linkage/Source/Client/Session/SessionPredicates.cpp.h index 9716afad8..4147767db 100644 --- a/Source/Linkage/Source/Client/Session/SessionPredicates.cpp.h +++ b/Source/Linkage/Source/Client/Session/SessionPredicates.cpp.h @@ -2,9 +2,11 @@ #include #include +#include #include using SummonHpTree = std::_Tree, std::allocator>, false>>; extern template std::_Tree_find_result, void*>*> SummonHpTree::_Find_lower_bound(const std::int64_t&) const; +extern template std::string::basic_string(const std::string&);