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>
77 lines
2.2 KiB
C++
77 lines
2.2 KiB
C++
#ifndef _RYL_SERVER_GROUP_SETUP_H_
|
|
#define _RYL_SERVER_GROUP_SETUP_H_
|
|
|
|
#pragma warning(disable:4800)
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <boost/pool/pool_alloc.hpp>
|
|
|
|
class CRylServerGroupSetup
|
|
{
|
|
public:
|
|
|
|
typedef std::basic_string<char, std::char_traits<char>, boost::pool_allocator<char> >
|
|
boost_string;
|
|
|
|
typedef std::map<unsigned long, boost_string, std::less<unsigned long>,
|
|
boost::pool_allocator<std::pair<unsigned long, boost_string> > >
|
|
ServerStringMap;
|
|
|
|
enum SetupType
|
|
{
|
|
SERVER_GROUP,
|
|
SERVER_TYPE,
|
|
SERVER_ZONE,
|
|
SERVER_CHANNEL
|
|
};
|
|
|
|
static CRylServerGroupSetup& GetInstance();
|
|
|
|
const char* GetSetupString(SetupType eSetupType, unsigned long dwKey);
|
|
unsigned long GetStringNum(SetupType eSetupType);
|
|
|
|
void Load(const char* szFileName = GetInstance().GetSetupFileName());
|
|
void Save(const char* szFileName = GetInstance().GetSetupFileName());
|
|
|
|
void SetSetupFileName(const char* szFileName);
|
|
const char* GetSetupFileName() { return m_szSetupFileName; }
|
|
|
|
template<typename FnProcess>
|
|
void EnumSetup(SetupType eSetupType, FnProcess fnProcess)
|
|
{
|
|
ServerStringMap::iterator pos;
|
|
ServerStringMap::iterator end;
|
|
|
|
switch(eSetupType)
|
|
{
|
|
case SERVER_GROUP: pos = m_ServerGroup.begin(); end = m_ServerGroup.end(); break;
|
|
case SERVER_TYPE: pos = m_ServerType.begin(); end = m_ServerType.end(); break;
|
|
case SERVER_ZONE: pos = m_ServerZone.begin(); end = m_ServerZone.end(); break;
|
|
case SERVER_CHANNEL: pos = m_ServerChannel.begin(); end = m_ServerChannel.end(); break;
|
|
|
|
default:
|
|
return;
|
|
}
|
|
|
|
for(; pos != end; ++pos)
|
|
{
|
|
ServerStringMap::value_type& value = *pos;
|
|
fnProcess(value.first, value.second.c_str());
|
|
}
|
|
}
|
|
|
|
private:
|
|
|
|
CRylServerGroupSetup();
|
|
~CRylServerGroupSetup();
|
|
|
|
ServerStringMap m_ServerGroup;
|
|
ServerStringMap m_ServerType;
|
|
ServerStringMap m_ServerZone;
|
|
ServerStringMap m_ServerChannel;
|
|
|
|
char m_szSetupFileName[MAX_PATH];
|
|
};
|
|
|
|
#endif |