1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 11:19:10 +00:00

Replace hsStream::Open duplicated methods everywhere with a single plFileName interface

This commit is contained in:
2013-01-17 21:08:21 -08:00
parent 219061c095
commit 6f6ade2636
60 changed files with 509 additions and 982 deletions

View File

@ -247,18 +247,10 @@ void DummyPrintFn( const char *line )
//// ExecuteFile /////////////////////////////////////////////////////////////
bool pfConsoleEngine::ExecuteFile( const char *fileName )
bool pfConsoleEngine::ExecuteFile(const plFileName &fileName)
{
wchar_t* wFilename = hsStringToWString(fileName);
bool ret = ExecuteFile(wFilename);
delete [] wFilename;
return ret;
}
bool pfConsoleEngine::ExecuteFile( const wchar_t *fileName )
{
char string[ 512 ];
int line;
char string[ 512 ];
int line;
hsStream* stream = plEncryptedStream::OpenEncryptedFile(fileName);
@ -273,13 +265,14 @@ bool pfConsoleEngine::ExecuteFile( const wchar_t *fileName )
return true;
}
for( line = 1; stream->ReadLn( string, sizeof( string ) ); line++ )
for( line = 1; stream->ReadLn( string, arrsize( string ) ); line++ )
{
strncpy( fLastErrorLine, string, sizeof( fLastErrorLine ) );
strncpy( fLastErrorLine, string, arrsize( fLastErrorLine ) );
if( !RunCommand( string, DummyPrintFn ) )
{
sprintf( string, "Error in console file %S, command line %d: %s", fileName, line, fErrorMsg );
snprintf(string, arrsize(string), "Error in console file %s, command line %d: %s",
fileName.AsString().c_str(), line, fErrorMsg);
ISetErrorMsg( string );
stream->Close();
delete stream;

View File

@ -57,6 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h"
class plFileName;
//// pfConsoleEngine Class Definition ////////////////////////////////////////
@ -94,8 +95,7 @@ class pfConsoleEngine
bool RunCommand( char *line, void (*PrintFn)( const char * ) );
// Executes the given file as a sequence of console commands
bool ExecuteFile( const char *fileName );
bool ExecuteFile( const wchar_t *fileName );
bool ExecuteFile( const plFileName &fileName );
// Get the last reported error
const char *GetErrorMsg( void ) { return fErrorMsg; }