Files
Client/Server/AdminTool/AdminToolClient/CharacterDoc.cpp
LGram16 dd97ddec92 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>
2025-11-29 20:17:20 +09:00

95 lines
1.8 KiB
C++

#include "stdafx.h"
#include "CharacterDoc.h"
CCharacterDoc::~CCharacterDoc()
{
Destroy();
}
void CCharacterDoc::Destroy()
{
isMapDoc::iterator itr = m_mapCharDoc.begin();
for(;itr != m_mapCharDoc.end(); ++itr)
{
delete itr->second;
}
m_mapCharDoc.clear();
m_listServerInfo.clear();
}
unsigned long CCharacterDoc::PushCharDocInfo(CharDocInfo* lpCharDocInfo)
{
m_mapCharDoc.insert(std::make_pair(++m_dwKey, lpCharDocInfo));
lpCharDocInfo->m_dwDocKey = m_dwKey;
return m_dwKey;
}
CCharacterDoc::CharDocInfo* CCharacterDoc::GetCharDocInfo(unsigned long dwKey)
{
isMapDoc::iterator itr = m_mapCharDoc.find(dwKey);
if(itr != m_mapCharDoc.end())
{
return itr->second;
}
return NULL;
}
bool CCharacterDoc::DeleteCharDocInfo(unsigned long dwKey)
{
isMapDoc::iterator itr = m_mapCharDoc.find(dwKey);
if(itr != m_mapCharDoc.end())
{
delete itr->second;
m_mapCharDoc.erase(itr);
return true;
}
return false;
}
void CCharacterDoc::PushServerGroup(CString strServerName, unsigned long dwServerIndex)
{
m_listServerInfo.push_back(ServerInfo(strServerName, dwServerIndex));
}
bool CCharacterDoc::GetServerIndex(CString strServerName, unsigned long& dwServerIndex)
{
islistServerInfo::iterator pos = m_listServerInfo.begin();
while(pos != m_listServerInfo.end())
{
if(!_tcsicmp((*pos).m_strServerName, strServerName))
{
dwServerIndex = (*pos).m_dwServerIndex;
return true;
}
++pos;
}
return false;
}
bool CCharacterDoc::GetServerName(unsigned long dwServerGroup, CString& strServerName)
{
islistServerInfo::iterator pos = m_listServerInfo.begin();
while(pos != m_listServerInfo.end())
{
if((*pos).m_dwServerIndex == dwServerGroup)
{
strServerName = (*pos).m_strServerName;
return true;
}
++pos;
}
strServerName = _T("UNKNOWN");
return false;
}