Administrative source import: native x86 compilation passed for 423 authored units. Source placement and submission states are migrated separately; this commit does not imply peer acceptance.
Previous head: 35d2a8cb36
Payload SHA256: 592f016d2730c5593bb653aa054c1e5f76a6df72c8f5a09e66f74876e2e33dee
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#ifndef RAGNAROK_SOURCE_CONTENTS_PLAYERNAMEDICTIONARY_H
|
|
#define RAGNAROK_SOURCE_CONTENTS_PLAYERNAMEDICTIONARY_H
|
|
|
|
#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 {
|
|
std::string name;
|
|
std::uint32_t tick;
|
|
};
|
|
struct Request {
|
|
std::uint32_t id;
|
|
std::uint32_t tick;
|
|
};
|
|
/* 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
|