rodecomp/Source/Contents/PlayerNameDictionary.h
ragnarok-clanker 9ac3d05245 Maintenance: Add mandatory field offset markers /* XXXX */ and assertions to Contents headers (part 2: Items, Models, Movies, Skills,
Batch #1063 by ragnarok-clanker: no function's compiled code changes; checked with 62 compiled unit(s), including every includer of Source/Contents/Items/ItemNaming.h, Source/Contents/Models/ModelActor.h, Source/Contents/Models/ModelRendering.h, Source/Contents/Models/ModelSpatial.h, Source/Contents/Movies/BinkMovie.h, Source/Contents/Movies/BinkMovies.h, Source/Contents/PlayerNameDictionary.h, Source/Contents/Skills/AutomaticSkills.h, Source/Contents/Skills/ClientSkills.h, Source/Contents/Skills/PlayerSkillBundle.h, Source/Contents/Skills/SkillInfo.h, Source/Contents/Sound/SoundMgr.h, Source/Contents/UserData/NormalItemSlots.h, Source/Contents/World/WorldModelLoading.h, Source/Contents/World/WorldModelView.h, Source/Contents/World/WorldRayQuery.h.
2026-10-27 13:52:05 +00:00

56 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 CConnection;
struct PlayerNameContext {
CConnection& connection;
const bool& languagePrefix;
const int& service;
const WORD& language;
};
class CPlayerNameDictionary {
public:
explicit CPlayerNameDictionary(PlayerNameContext& context);
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;
};
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;
PlayerNameContext* m_context;
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(CPlayerNameDictionary) == 60);
#endif
#endif