コード例 #1
0
ファイル: host.cpp プロジェクト: mefisto2009/rehlds
/* <36123> ../engine/host.c:255 */
void __declspec(noreturn) Host_Error(const char *error, ...)
{
	va_list argptr;
	char string[1024];
	static qboolean inerror = FALSE;

	va_start(argptr, error);

	if (inerror)
		Sys_Error("Host_Error: recursively entered");

	inerror = TRUE;
	SCR_EndLoadingPlaque();
	Q_vsnprintf(string, sizeof(string), error, argptr);
	va_end(argptr);

	if (g_psv.active && developer.value != 0.0 )
		CL_WriteMessageHistory(0, 0);

	Con_Printf("Host_Error: %s\n", string);
	if (g_psv.active)
		Host_ShutdownServer(FALSE);

	if (g_pcls.state)
	{
		CL_Disconnect();
		g_pcls.demonum = -1;
		inerror = FALSE;
		longjmp(host_abortserver, 1);
	}
	Sys_Error("Host_Error: %s\n", string);
}
コード例 #2
0
ファイル: host.c プロジェクト: ptitSeb/xash3d
/*
=================
Host_Error
=================
*/
void Host_Error( const char *error, ... )
{
	static char	hosterror1[MAX_SYSPATH];
	static char	hosterror2[MAX_SYSPATH];
	static qboolean	recursive = false;
	va_list		argptr;

	if( host.mouse_visible && !CL_IsInMenu( ))
	{
		// hide VGUI mouse
#ifdef XASH_SDL
		SDL_ShowCursor( false );
#endif
		host.mouse_visible = false;
	}

	va_start( argptr, error );
	Q_vsprintf( hosterror1, error, argptr );
	va_end( argptr );

	CL_WriteMessageHistory (); // before Q_error call

	if( host.framecount < 3 )
	{
		Sys_Error( "Host_InitError: %s", hosterror1 );
	}
	else if( host.framecount == host.errorframe )
	{
		Sys_Error( "Host_MultiError: %s", hosterror2 );
		return;
	}
	else
	{
		if( host.developer > 0 )
		{
			UI_SetActiveMenu( false );
			Key_SetKeyDest( key_console );
			Msg( "^1Host_Error: ^7%s", hosterror1 );
		}
		else MSGBOX2( hosterror1 );
	}

	// host is shutting down. don't invoke infinite loop
	if( host.state == HOST_SHUTDOWN ) return;

	if( recursive )
	{ 
		Msg( "Host_RecursiveError: %s", hosterror2 );
		Sys_Error( hosterror1 );
		return; // don't multiple executes
	}

	recursive = true;
	Q_strncpy( hosterror2, hosterror1, MAX_SYSPATH );
	host.errorframe = host.framecount; // to avoid multple calls per frame
	Q_sprintf( host.finalmsg, "Server crashed: %s", hosterror1 );

	// clear cmd buffer to prevent execution of any commands
	Cbuf_Clear();

	SV_Shutdown( false );
	CL_Drop(); // drop clients

	// recreate world if required
	CL_ClearEdicts ();

	// release all models
	Mod_ClearAll( false );

	recursive = false;

	Host_AbortCurrentFrame();
}