void CApplication::Run( int argc, char* argv[] ) { startupError = 0; buildName = ENGINE_NAME; buildName += " (build: "; buildName += MakeBuildNumber( __DATE__ ); buildName += " version: "; buildName += ENGINE_VERSION; buildName += ")"; // get and set the working directory appDir = getDirectoryFromArgs( argc, argv ); changeWorkingDir( appDir ); //open logfiles log = new CAppLog( "Logs/app.txt", true ); APPLOG.Write( wide2string( buildName ).c_str() ); //create a couple of singletons network = new CNetwork(); if ( argc > 1 ) { modDir = argv[1]; } else { modDir = DEFAULT_MODDIR; } modDir += "/"; //load and run the game String dllFile = modDir; dllFile += GAME_MODULE; if ( !LoadGameDLL( dllFile.c_str(), argc, argv ) ) { startupError = ERROR_DLL_NOTLOADED; APPLOG.Write( "Could not load game module %s", dllFile.c_str() ); } // no script and console at this point for ( int i = 0; i < modules.size(); i++ ) { if ( modules[i] ) { FreeLibrary( ( HMODULE )modules[i] ); } } //clean up singletons delete network; if ( startupError > 0 ) { getchar(); } }
int main( ) { char buf[ 256 ]; GetCurrentDirectory( 256, buf ); LoadGameDLL( ); while( 1 ) { FILETIME newTime = Win32GetLastWriteTime( "game.dll" ); if ( CompareFileTime( &newTime, &GameDLLWriteTime ) ) LoadGameDLL( ); LoopPtr( ); } return 0; }