Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
89
Engine/Zalla3D Scene Class/Z3DMapTok2FileName.cpp
Normal file
89
Engine/Zalla3D Scene Class/Z3DMapTok2FileName.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
// Z3DMapTok2FileName.cpp: implementation of the CZ3DMapTok2FileName class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Z3DMapTok2FileName.h"
|
||||
#include "SimpleParser.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CZ3DMapTok2FileName::CZ3DMapTok2FileName()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CZ3DMapTok2FileName::~CZ3DMapTok2FileName()
|
||||
{
|
||||
std::map<Z3DTOK, char* >::iterator it;
|
||||
|
||||
for( it = m_mapTok2FileName.begin(); it != m_mapTok2FileName.end(); it++ )
|
||||
{
|
||||
SAFE_DELETEA( it->second );
|
||||
}
|
||||
}
|
||||
|
||||
bool CZ3DMapTok2FileName::Load( const char* szFileName, const char* szFilePath, CZ3DStringTable& rTable )
|
||||
{
|
||||
CSimpleParser parser;
|
||||
if( false == parser.OpenFile( szFileName ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char* szPrefix = NULL;
|
||||
long lLength = strlen( szFilePath );
|
||||
if( '/' != szFilePath[lLength-1] && '\\' != szFilePath[lLength-1] )
|
||||
{
|
||||
szPrefix = new char[lLength+2];
|
||||
sprintf( szPrefix, "%s/", szFilePath );
|
||||
++lLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
szPrefix = new char[lLength+1];
|
||||
strcpy( szPrefix, szFilePath );
|
||||
}
|
||||
|
||||
char* szToken;
|
||||
char* szStr;
|
||||
Z3DTOK tok;
|
||||
while( NULL != (szToken = parser.GetNextToken()) )
|
||||
{
|
||||
tok = rTable.Add( szToken );
|
||||
if( m_mapTok2FileName.end() != m_mapTok2FileName.find(tok) )
|
||||
{
|
||||
// <20>ߺ<EFBFBD>
|
||||
return false;
|
||||
}
|
||||
szToken = parser.GetNextToken();
|
||||
if( NULL == szToken )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
szStr = new char[lLength + strlen(szToken) + 1];
|
||||
sprintf( szStr, "%s%s", szPrefix, szToken );
|
||||
m_mapTok2FileName[tok] = szStr;
|
||||
}
|
||||
|
||||
SAFE_DELETEA( szPrefix );
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* CZ3DMapTok2FileName::GetFileName( Z3DTOK tok )
|
||||
{
|
||||
std::map<Z3DTOK, char* >::iterator it;
|
||||
|
||||
it = m_mapTok2FileName.find( tok );
|
||||
|
||||
if( it == m_mapTok2FileName.end() )
|
||||
{
|
||||
//return NULL;
|
||||
return "";
|
||||
}
|
||||
|
||||
return it->second;
|
||||
}
|
||||
Reference in New Issue
Block a user