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:
116
GameTools/Zallad3D SceneClass/Z3DStringTable.cpp
Normal file
116
GameTools/Zallad3D SceneClass/Z3DStringTable.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
// Z3DStringTable.cpp: implementation of the CZ3DStringTable class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Z3DStringTable.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
long CZ3DStringTable::ms_lTableCount(0L);
|
||||
const Z3DTOK NULL_TOK(0L);
|
||||
|
||||
|
||||
CZ3DStringTable::CZ3DStringTable()
|
||||
{
|
||||
++ms_lTableCount;
|
||||
if( ms_lTableCount > 0x3FF )
|
||||
{
|
||||
ms_lTableCount = 1;
|
||||
}
|
||||
|
||||
m_lTablenum = ms_lTableCount;
|
||||
m_lTOKCount = 0;
|
||||
}
|
||||
|
||||
CZ3DStringTable::~CZ3DStringTable()
|
||||
{
|
||||
std::map<char*, Z3DTOK, szi_less>::iterator it;
|
||||
|
||||
char* sz;
|
||||
for( it = m_mapString2TOK.begin(); it != m_mapString2TOK.end(); it++ )
|
||||
{
|
||||
sz = it->first;
|
||||
SAFE_DELETEA( sz );
|
||||
}
|
||||
|
||||
// map<61><70><EFBFBD><EFBFBD> flushing<6E><67> <20>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>..(<28>Ҹ<EFBFBD><D2B8><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD>Ǵϱ<C7B4>-_-a)
|
||||
}
|
||||
|
||||
|
||||
Z3DTOK CZ3DStringTable::Add( const char* szKey )
|
||||
{
|
||||
std::map<char*, Z3DTOK, szi_less>::iterator it;
|
||||
|
||||
it = m_mapString2TOK.find( const_cast<char*>(szKey) );
|
||||
if( m_mapString2TOK.end() != it )
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
|
||||
//else
|
||||
char* sz = new char[strlen(szKey)+1];
|
||||
strcpy( sz, szKey );
|
||||
++m_lTOKCount;
|
||||
Z3DTOK tok;
|
||||
tok.lTblNum = m_lTablenum;
|
||||
tok.lItemNum = m_lTOKCount;
|
||||
m_mapString2TOK[sz] = tok;
|
||||
m_mapTOK2String[tok] = sz;
|
||||
|
||||
return tok;
|
||||
}
|
||||
|
||||
|
||||
Z3DTOK CZ3DStringTable::GetTOK( const char* szKey )
|
||||
{
|
||||
if( NULL == szKey )
|
||||
{
|
||||
return NULL_TOK;
|
||||
}
|
||||
|
||||
std::map<char*, Z3DTOK, szi_less>::iterator it;
|
||||
|
||||
it = m_mapString2TOK.find( const_cast<char*>(szKey) );
|
||||
if( m_mapString2TOK.end() == it )
|
||||
{
|
||||
return NULL_TOK;
|
||||
}
|
||||
|
||||
//else
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
||||
const char* CZ3DStringTable::GetString( const Z3DTOK tok )
|
||||
{
|
||||
std::map<Z3DTOK, char*>::iterator it;
|
||||
|
||||
it = m_mapTOK2String.find( tok );
|
||||
if( m_mapTOK2String.end() == it )
|
||||
{
|
||||
//return NULL;
|
||||
return "";
|
||||
}
|
||||
|
||||
//else
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
||||
void CZ3DStringTable::Flush()
|
||||
{
|
||||
std::map<char*, Z3DTOK, szi_less>::iterator it;
|
||||
|
||||
char* sz;
|
||||
for( it = m_mapString2TOK.begin(); it != m_mapString2TOK.end(); it++ )
|
||||
{
|
||||
sz = it->first;
|
||||
SAFE_DELETEA( sz );
|
||||
}
|
||||
|
||||
m_mapString2TOK.clear();
|
||||
|
||||
m_lTOKCount = 0;
|
||||
}
|
||||
Reference in New Issue
Block a user