Exemplo n.º 1
0
//-----------------------------------------------------------------------------------
//		GameServerMain
//-----------------------------------------------------------------------------------
int GameServerMain(int argc, _TCHAR* argv[])
{
	CGameServer app;
	CNtlFileStream traceFileStreams;

// LOG FILE
	int rc = traceFileStreams.Create( "gamelog" );
	if( NTL_SUCCESS != rc )
	{
		printf( "log file CreateFile error %d(%s)", rc, NtlGetErrorMessage( rc ) );
		return rc;
	}

// CHECK INI FILE AND START PROGRAM
	NtlSetPrintStream( traceFileStreams.GetFilePtr() );
	NtlSetPrintFlag( PRINT_APP | PRINT_SYSTEM );


	rc = app.Create(argc, argv, ".\\Server.ini");
	if( NTL_SUCCESS != rc )
	{
		NTL_PRINT(PRINT_APP, "Server Application Create Fail %d(%s)", rc, NtlGetErrorMessage(rc) );
		return rc;
	}

	// CONNECT TO MYSQL
	app.db = new MySQLConnWrapper;
	app.db->setConfig(app.GetConfigFileHost(), app.GetConfigFileUser(), app.GetConfigFilePassword(), app.GetConfigFileDatabase());
	app.db->connect();
	app.db->switchDb(app.GetConfigFileDatabase());
	CleanDatabase();
	// NEW CLASS
	app.mob = new MobActivity();
	app.mob->app = &app;
	app.Start();
	Sleep(500);
	std::cout << "\n\n" << std::endl;
	std::cout << "\t  ____                              ____        _ _ " << std::endl;
	std::cout << "\t |  _ \\ _ __ __ _  __ _  ___  _ __ | __ )  __ _| | |" << std::endl;
	std::cout << "\t | | | | '__/ _` |/ _` |/ _ \\| '_ \\|  _ \\ / _` | | |" << std::endl;
	std::cout << "\t | |_| | | | (_| | (_| | (_) | | | | |_) | (_| | | |" << std::endl;
	std::cout << "\t |____/|_|  \\__,_|\\__, |\\___/|_| |_|____/ \\__,_|_|_|" << std::endl;
	std::cout << "\t                  |___/                             " << std::endl;
	std::cout << "\t______           AKCore :O 2014					______\n\n" << std::endl;
	printf("<Ctrl-C> to stop.\n");
	app.WaitForTerminate();

	return 0;
}
Exemplo n.º 2
0
//-----------------------------------------------------------------------------------
//		AuthServerMain
//-----------------------------------------------------------------------------------
int AuthServerMain(int argc, _TCHAR* argv[])
{
    CAuthServer app;
    CNtlFileStream traceFileStream;

// LOG FILE
    int rc = traceFileStream.Create( "authlog" );
    if( NTL_SUCCESS != rc )
    {
        printf( "log file CreateFile error %d(%s)", rc, NtlGetErrorMessage( rc ) );
        return rc;
    }

// CONNECT TO MYSQL
    app.db = new MySQLConnWrapper;
    app.db->connect();
    app.db->switchDb("dbo");


// CHECK INI FILE AND START PROGRAM
    NtlSetPrintStream( traceFileStream.GetFilePtr() );
    NtlSetPrintFlag( PRINT_APP | PRINT_SYSTEM );

    rc = app.Create(argc, argv, ".\\Server.ini");
    if( NTL_SUCCESS != rc )
    {
        NTL_PRINT(PRINT_APP, "Server Application Create Fail %d(%s)", rc, NtlGetErrorMessage(rc) );
        return rc;
    }

    app.Start();
    Sleep(500);
    std::cout << "\n\n" << std::endl;
    std::cout << "\t  ____                              ____        _ _ " << std::endl;
    std::cout << "\t |  _ \\ _ __ __ _  __ _  ___  _ __ | __ )  __ _| | |" << std::endl;
    std::cout << "\t | | | | '__/ _` |/ _` |/ _ \\| '_ \\|  _ \\ / _` | | |" << std::endl;
    std::cout << "\t | |_| | | | (_| | (_| | (_) | | | | |_) | (_| | | |" << std::endl;
    std::cout << "\t |____/|_|  \\__,_|\\__, |\\___/|_| |_|____/ \\__,_|_|_|" << std::endl;
    std::cout << "\t                  |___/                             " << std::endl;
    std::cout << "\t______           AKCore :O 2014					______\n\n" << std::endl;
    app.WaitForTerminate();


    return 0;
}