Batch #10200 by ragnarok-clanker: forced by an admin (2 lower score(s), 7 changed function(s)); checked with 43 compiled unit(s), including every includer of Source/Contents/PlayerNameDictionary.h, Source/Contents/Skills/AutomaticSkills.h, Source/UI/Window/WindowRetirement.h. Deletes: Source/UI/Window/WindowRetirement.h
54 lines
1.4 KiB
C++
54 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;
|
|
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
|