Restructure repository to include all source folders
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>
This commit is contained in:
105
Server/RylServerProject/RylUIDServer/UserIDTable.cpp
Normal file
105
Server/RylServerProject/RylUIDServer/UserIDTable.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
#include "stdAfx.h"
|
||||
#include <Log/ServerLog.h>
|
||||
#include "UserIDTable.h"
|
||||
|
||||
CUserNode::CUserNode(unsigned long dwUserID, unsigned long dwSessionID,
|
||||
unsigned long dwCharID, unsigned char cGroup, unsigned char cState)
|
||||
: m_dwUserID(dwUserID), m_dwSessionID(dwSessionID),
|
||||
m_dwCharID(dwCharID), m_cAgentGroup(cGroup), m_cState(cState)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
CUserNode::~CUserNode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CUserNode::InitUserNode(unsigned long dwUserID, unsigned long dwSessionID,
|
||||
unsigned long dwCharID, unsigned char cGroup, unsigned char cState)
|
||||
{
|
||||
m_cAgentGroup = cGroup;
|
||||
m_cState = cState;
|
||||
m_dwSessionID = dwSessionID;
|
||||
m_dwUserID = dwUserID;
|
||||
m_dwCharID = dwCharID;
|
||||
}
|
||||
|
||||
|
||||
CUserIDTable& CUserIDTable::GetInstance()
|
||||
{
|
||||
static CUserIDTable userIDTable;
|
||||
return userIDTable;
|
||||
}
|
||||
|
||||
|
||||
CUserIDTable::CUserIDTable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CUserIDTable::~CUserIDTable()
|
||||
{
|
||||
m_UIDTable.clear();
|
||||
}
|
||||
|
||||
|
||||
BOOL CUserIDTable::Insert(unsigned long dwUserID, const CUserNode& Node)
|
||||
{
|
||||
if(m_UIDTable.insert(std::make_pair(dwUserID, Node)).second)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
SERLOG1(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(0x%08x)<29><> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20>ִµ<D6B4> <20><><EFBFBD><EFBFBD>", dwUserID);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL CUserIDTable::Erase(unsigned long dwUserID)
|
||||
{
|
||||
UIDTable::iterator itr = m_UIDTable.find(dwUserID);
|
||||
if(itr != m_UIDTable.end())
|
||||
{
|
||||
m_UIDTable.erase(itr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
CUserNode* CUserIDTable::Find(unsigned long dwUserID)
|
||||
{
|
||||
UIDTable::iterator itr = m_UIDTable.find(dwUserID);
|
||||
return (itr != m_UIDTable.end()) ? (&itr->second) : 0;
|
||||
}
|
||||
|
||||
|
||||
int CUserIDTable::RemoveUserOfCurrentAgent(char Group)
|
||||
{
|
||||
int nNum = 0;
|
||||
INFLOG1(g_Log, "<EFBFBD><EFBFBD>(%d)<29><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>", Group);
|
||||
|
||||
UIDTable::iterator pos = m_UIDTable.begin();
|
||||
UIDTable::iterator end = m_UIDTable.end();
|
||||
|
||||
for(; pos != end; )
|
||||
{
|
||||
CUserNode& node = pos->second;
|
||||
|
||||
if(node.GetAgentGroup() == Group)
|
||||
{
|
||||
pos = m_UIDTable.erase(pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
|
||||
INFLOG2(g_Log, "<EFBFBD><EFBFBD>(%d)<29><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> %d", Group, nNum);
|
||||
return nNum;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user