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>
64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
// StringTable.cpp: implementation of the CStringTable class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "StringTable.h"
|
|
#include "windows.h"
|
|
#include "ScriptEngine.h"
|
|
#include <string.h>
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CStringTable g_StringTable;
|
|
|
|
CStringTable::CStringTable()
|
|
{
|
|
m_dwStringCount = 0;
|
|
}
|
|
|
|
CStringTable::~CStringTable()
|
|
{
|
|
|
|
}
|
|
|
|
static void ScriptErrorMessage(const char *msg)
|
|
{
|
|
MessageBox(NULL, msg, "Script Error", MB_OK);
|
|
}
|
|
|
|
static void AddString(const char *strMessage)
|
|
{
|
|
if(strMessage)
|
|
{
|
|
strcpy(g_StringTable.m_strString[g_StringTable.m_dwStringCount], strMessage);
|
|
g_StringTable.m_dwStringCount++;
|
|
}
|
|
}
|
|
|
|
static void AddStringCount(int nCount, const char *strMessage)
|
|
{
|
|
if(strMessage)
|
|
{
|
|
strcpy(g_StringTable.m_strString[nCount], strMessage);
|
|
g_StringTable.m_dwStringCount = nCount + 1;
|
|
}
|
|
}
|
|
|
|
bool CStringTable::Load(const char *strScriptFile)
|
|
{
|
|
_SE_SetMessageFunction(ScriptErrorMessage);
|
|
SCRIPT Script = _SE_Create(strScriptFile);
|
|
if(!Script) return false;
|
|
|
|
_SE_RegisterFunction(Script, AddString, T_VOID, "AddString", T_STRING, 0);
|
|
_SE_RegisterFunction(Script, AddStringCount, T_VOID, "AddString", T_INT, T_STRING, 0);
|
|
|
|
_SE_Execute(Script);
|
|
|
|
_SE_Destroy(Script);
|
|
|
|
return true;
|
|
}
|