Exemplo n.º 1
0
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
	HWND hWnd;

	hInst = hInstance; // Store instance handle in our global variable

	hMainWnd	= hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
	  CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

	if (!hWnd)
		return FALSE;

	SetTimer( hMainWnd, 3, SEC( 60 ), NULL );	// 10(s)

	int x = 480, y = 606;
	SetWindowPos( hWnd, NULL, x, y, 400, 416, SWP_SHOWWINDOW );

	g_MyTrace.Initialize( hWnd, "SquireD", RGB( 0x00, 0x00, 0x00 ), RGB( 0xff, 0xff, 0xff ) );

	CTime time	= CTime::GetCurrentTime();
	g_MyTrace.Add( 0, FALSE, "%s", time.Format( "%Y/%m/%d %H:%M:%S" ) );
	g_MyTrace.AddLine( '\0' );

#ifndef _DEBUG
//   InitEH();
#endif	// _DEBUG

	if( !Script( "CacheServer.ini" ) )
		return FALSE;

	if( InitializeNetLib() == FALSE )
		return FALSE;

	if( !g_DPCoreClient.ConnectToServer( g_szCoreAddr, PN_CORESRVR + 1 ) )
		return FALSE;
	
#ifdef __CRC
	if( !g_DPCacheSrvr.StartServer( g_uPort, FALSE, CSock::crcRead ) )
#else	// __CRC
	if( !g_DPCacheSrvr.StartServer( g_uPort ) )
#endif	// __CRC
		return FALSE;


	g_MyTrace.AddLine( '-' );
	char lpszIpAddr[16];
	g_DPCoreClient.GetPlayerAddr( DPID_SERVERPLAYER, lpszIpAddr );

	g_MyTrace.Add( CMyTrace::Key( "main" ), FALSE, "%s", lpszIpAddr );
	g_MyTrace.AddLine( '-' );

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}
Exemplo n.º 2
0
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
    // Set up the highest resolution timer we can manage 
//	TIMECAPS tc; 
//	UINT nPeriod;
//	if( TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(tc)) ) 
//		nPeriod = tc.wPeriodMin;
//	else
//		nPeriod = 1;  
//	timeBeginPeriod( nPeriod ); 

	HWND hWnd;
	g_hMainWnd	= hWnd	= CreateWindow(g_szWindowClass, g_szTitle, WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

	int x = 480, y = 0;
	SetWindowPos( hWnd, NULL, x, y, 800, 416, SWP_SHOWWINDOW );

	if (!hWnd)
		return FALSE;

	SetTimer( g_hMainWnd, 0, SEC( 60 ), NULL );	// 60
	SetTimer( g_hMainWnd, 1, MIN( 60 ), NULL );	// 3600

	CTime time = CTime::GetCurrentTime();
	SetLogInfo( LOGTYPE_TIME, "%s", time.Format( "%Y/%m/%d %H:%M:%S" ) );

	ShowWindow(hWnd, nCmdShow);
	UpdateWindow(hWnd);

#ifndef _DEBUG
// 	#if defined(__MINIDUMP)
// 		InitDumper( DUMP_LEVEL_0 );
// 	#else
// 		InitEH();
// 	#endif // !__MINIDUMP
#endif	// _DEBUG

	EnableFloatException();

	if( InitializeNetLib() == FALSE )
		return FALSE;

	if( InitializeScriptLib() == FALSE )
		return FALSE;

	xSRand( timeGetTime()  );	// 속도를 요하는 랜덤은 xRandom()을 쓰도록...

	if( Script( g_szINI ) == TRUE )
	{
		if( !prj.OpenProject( "Masquerade.prj" ) ) 
		{
			Error( "OpenProject ERROR check Masquerade.prj" );
			return FALSE;
		}

		SetLogInfo( LOGTYPE_REDRAW, "" );
		SetTitle();

		if( CompileItemScript( "ItemScript.lua" ) == FALSE )
			return FALSE;

	#if defined(__REMOVE_SCIRPT_060712)
		if( CWorldDialog::GetInstance().Init() == FALSE )
		{
			OutputDebugString( "WorldDialog.DLL load failed\n" );
			return FALSE;
		}
	#endif
		return CRunObject::GetInstance()->Init();
	}
	else
	{
		char szBuffer[300] = {0,};
		char szDir[255] = {0,};
		GetCurrentDirectory( 255, szDir );
		sprintf( szBuffer, "%s\\WorldServer.ini File not found", szDir );
		AfxMessageBox( szBuffer );
		return FALSE;
	}
}
Exemplo n.º 3
0
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
	HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

	hMainWnd	= hWnd	=
		CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

   if (!hWnd)
   {
      return FALSE;
   }

	int x = 0, y = 416;
	SetWindowPos( hWnd, NULL, x, y, 400, 416, SWP_SHOWWINDOW );

	g_GameTimer.Compute();
	SetTimer( hWnd, TIMER_ID_DEFAULT, 1000, NULL );

#if !defined(__INTERNALSERVER)
	SetTimer( hWnd, TIMER_ID_WANTED, g_uWantedElapse, NULL );
#endif

#ifdef __EVENT0913
	SetTimer( hWnd, TIMER_ID_EVENT0913, 1000, NULL );
#endif	// __EVENT0913
#ifdef __EVENT1206
	SetTimer( hWnd, TIMER_ID_EVENT1206, 1000 * 60, NULL );
#endif	// __EVENT1206

	SetTimer( hWnd, TIMER_ID_EVENT, 1000 * 60, NULL );

	g_MyTrace.Initialize( hWnd, "SquireD", RGB( 0xff, 0xff, 0xff ), RGB( 0x00, 0x00, 0x00 ) );

	CTime time	= CTime::GetCurrentTime();
	g_MyTrace.Add( 0, FALSE, "%s", time.Format( "%Y/%m/%d %H:%M:%S" ) );
	g_MyTrace.AddLine( '\0' );

#ifndef _DEBUG
//	InitEH();
#endif	// _DEBUG

	g_TickCount.Start();

	if( !Script( "CoreServer.ini" ) )
	{
		return FALSE;
	}
	
	if( InitializeNetLib() == FALSE )
		return FALSE;

	if( !g_dpCoreSrvr.StartServer( PN_CORESRVR + 0 ) )
		return FALSE;

	if( !g_DPCacheSrvr.StartServer( PN_CORESRVR + 1 ) )
		return FALSE;

	if( !g_dpLoginSrvr.StartServer( PN_CORESRVR + 2 ) )
		return FALSE;

	if( !g_dpDatabaseClient.ConnectToServer( szDataBaseAddr, PN_DBSRVR_2, FALSE ) )
	{
		Error( "Not TransServer Connect" );
		return FALSE;
	}

	if( !g_PartyMng.CreateWorkers() )
	{
		assert( 0 );
	}

#ifdef __ENVIRONMENT_EFFECT
	if( CEnvironment::GetInstance()->CreateWorkers() == FALSE )
	{
		assert( 0 );
	}
#else // __ENVIRONMENT_EFFECT
	if( !g_Environment.CreateWorkers() )
	{
		assert( 0 );
	}
#endif // __ENVIRONMENT_EFFECT

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}