Batch #13857 by eAthena: 2 byte-identical, 0 confirmed by peer review. - fn_04259 CreatePlayerNameDictionary: byte-identical - fn_04264 CPlayerNameDictionary::Contains: byte-identical Merged automatically: every function is byte-identical to the original.
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
#ifndef RAGNAROK_SOURCE_CONTENTS_PLAYERNAMEDICTIONARY_H
|
|
#define RAGNAROK_SOURCE_CONTENTS_PLAYERNAMEDICTIONARY_H
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <deque>
|
|
#include <map>
|
|
#include <string>
|
|
#include <windows.h>
|
|
|
|
class CPlayerNameDictionary {
|
|
public:
|
|
CPlayerNameDictionary();
|
|
virtual ~CPlayerNameDictionary();
|
|
std::string Lookup(std::uint32_t id);
|
|
void Set(std::uint32_t id, std::string name);
|
|
void Clear();
|
|
bool Contains(std::uint32_t id) const;
|
|
// INLINED
|
|
bool IsEnabled() const {
|
|
return this->m_enabled;
|
|
}
|
|
void Update();
|
|
|
|
private:
|
|
struct Entry {
|
|
/* 0000 */ std::string name;
|
|
/* 0018 */ std::uint32_t tick;
|
|
|
|
bool IsExpired() const;
|
|
};
|
|
struct Request {
|
|
/* 0000 */ std::uint32_t id;
|
|
/* 0004 */ std::uint32_t tick;
|
|
};
|
|
#if defined(_WIN32) && !defined(_WIN64)
|
|
static_assert(sizeof(Entry) == 0x1C);
|
|
static_assert(offsetof(Entry, tick) == 0x18);
|
|
static_assert(sizeof(Request) == 0x08);
|
|
static_assert(offsetof(Request, tick) == 0x04);
|
|
#endif
|
|
/* 0004 */ bool m_enabled;
|
|
/* 0008 */ std::map<std::uint32_t, Entry> m_names;
|
|
/* 0010 */ std::deque<std::uint32_t> m_pending;
|
|
/* 0024 */ std::deque<Request> m_requests;
|
|
};
|
|
|
|
#if defined(_WIN32) && !defined(_WIN64)
|
|
static_assert(sizeof(CPlayerNameDictionary) == 0x38);
|
|
#endif
|
|
|
|
extern CPlayerNameDictionary* g_playerNameDictionary;
|
|
|
|
bool CreatePlayerNameDictionary();
|
|
void DestroyPlayerNameDictionary();
|
|
std::string LookupPlayerName(std::uint32_t id);
|
|
|
|
#endif
|