Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
#ifndef _RYL_SERVER_BIND_RUN_ID_
|
|
#define _RYL_SERVER_BIND_RUN_ID_
|
|
|
|
#pragma warning(disable:4800)
|
|
|
|
#include <map>
|
|
#include <new>
|
|
#include <boost/pool/pool_alloc.hpp>
|
|
|
|
#include <tchar.h>
|
|
|
|
class CRylServerBindRunID
|
|
{
|
|
public:
|
|
|
|
static CRylServerBindRunID& GetInstance();
|
|
|
|
bool SetID(unsigned long dwRunID, unsigned long dwServerID);
|
|
bool RemoveFromRunID(unsigned long dwRunID);
|
|
bool RemoveFromServerID(unsigned long dwServerID);
|
|
|
|
bool GetRunID(unsigned long dwServerID, unsigned long* lpdwRunID);
|
|
bool GetServerID(unsigned long dwRunID, unsigned long* lpdwServerID);
|
|
|
|
void SetSetupFileName(const TCHAR* szSetupFileName);
|
|
|
|
bool Save();
|
|
bool Load();
|
|
|
|
template<typename FnProcess>
|
|
void EnumID(FnProcess fnProcess)
|
|
{
|
|
BindIDTable::iterator pos = m_RunID.begin();
|
|
BindIDTable::iterator end = m_RunID.end();
|
|
|
|
for(; pos != end; ++pos)
|
|
{
|
|
// first : RunID, Second : ServerID
|
|
fnProcess(pos->first, pos->second);
|
|
}
|
|
}
|
|
|
|
size_t GetPairNum() const { return m_RunID.size(); }
|
|
|
|
private:
|
|
|
|
typedef std::pair<unsigned long, unsigned long> BindID;
|
|
|
|
typedef std::map<unsigned long, unsigned long, std::less<unsigned long>,
|
|
boost::fast_pool_allocator<std::pair<unsigned long, unsigned long> > > BindIDTable;
|
|
|
|
CRylServerBindRunID();
|
|
~CRylServerBindRunID();
|
|
|
|
BindIDTable m_RunID; // key : RunID, value : ServerID
|
|
BindIDTable m_ServerID; // key : ServerID, value : RunID
|
|
|
|
TCHAR m_szDefaultSetupFileName[MAX_PATH];
|
|
};
|
|
|
|
#endif |