• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CL_Disconnect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CL_Disconnect函数的典型用法代码示例。如果您正苦于以下问题:C++ CL_Disconnect函数的具体用法?C++ CL_Disconnect怎么用?C++ CL_Disconnect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CL_Disconnect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CL_PlayDemo_f

/*
====================
CL_PlayDemo_f

play [demoname]
====================
*/
void CL_PlayDemo_f (void)
{
	char	name[256];

	if (Cmd_Argc() != 2)
	{
		Con_Printf ("play <demoname> : plays a demo\n");
		return;
	}

//
// disconnect from server
//
	CL_Disconnect ();
	
//
// open the demo file
//
	strcpy (name, Cmd_Argv(1));
	COM_DefaultExtension (name, ".qwd");

	Con_Printf ("Playing demo from %s.\n", name);
	COM_FOpenFile (name, &cls.demofile);
	if (!cls.demofile)
	{
		Con_Printf ("ERROR: couldn't open.\n");
		cls.demonum = -1;		// stop demo loop
		return;
	}

	cls.demoplayback = true;
	cls.state = ca_demostart;
	Netchan_Setup (&cls.netchan, net_from, 0);
	realtime = 0;
}
开发者ID:MaddTheSane,项目名称:Quake,代码行数:42,代码来源:cl_demo.c


示例2: Host_EndGame

/*
================
Host_EndGame
================
*/
void Host_EndGame (char *message, ...)
{
	va_list		argptr;
	char		string[1024];

	va_start (argptr,message);
	vsnprintf(string, sizeof(string), message,argptr);
	va_end (argptr);
	Con_DPrintf ("Host_EndGame: %s\n",string);

	if (sv.active)
		Host_ShutdownServer (false);

	if (cls.state == ca_dedicated)
		Sys_Error ("Host_EndGame: %s\n",string);	// dedicated servers exit

	if (cls.demonum != -1)
	{
		CL_StopPlayback ();	// JPG 1.05 - patch by CSR to fix crash
		CL_NextDemo ();
	}
	else
		CL_Disconnect ();

	longjmp (host_abortserver, 1);
}
开发者ID:darkduke606,项目名称:Insomnia-ProQuake-Engine,代码行数:31,代码来源:host.c


示例3: Host_Error

/**
 * This shuts down both the client and server
 */
void Host_Error(const char *error, ...) {
    va_list argptr;
    char string[1024];
    static bool inerror = false;

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

    SCR_EndLoadingPlaque(); // reenable screen updates

    va_start(argptr, error);
    vsprintf(string, error, argptr);
    va_end(argptr);
    Con_Printf("Host_Error: %s\n", string);

    if (sv.active)
        Host_ShutdownServer(false);

    if (cls.state == ca_dedicated)
        Sys_Error("Host_Error: %s\n", string); // dedicated servers exit

    CL_Disconnect();
    cls.demonum = -1;

    inerror = false;

    longjmp(host_abortserver, 1);
}
开发者ID:DrLabman,项目名称:QMB,代码行数:32,代码来源:host.cpp


示例4: Host_ShutdownServer

/*
==================
Host_ShutdownServer

This only happens at the end of a game, not between levels
==================
*/
void Host_ShutdownServer(qboolean crash)
{
	int		i, count;
	sizebuf_t	buf;
	unsigned char	message[4];
	double	start;

	if (!sv.active)
		return;

	sv.active = false;

// stop all client sounds immediately
	if (cls.state == ca_connected)
		CL_Disconnect ();

// flush any pending messages - like the score!!!
	start = Sys_DoubleTime();
	do {
		count = 0;
		for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
		{
			if (host_client->active && host_client->message.cursize)
			{
				if (NET_CanSendMessage (host_client->netconnection))
				{
					NET_SendMessage(host_client->netconnection, &host_client->message);
					SZ_Clear (&host_client->message);
				}
				else
				{
					NET_GetMessage(host_client->netconnection);
					count++;
				}
			}
		}
		if ((Sys_DoubleTime() - start) > 3.0)
			break;
	}
	while (count);

// make sure all the clients know we're disconnecting
	buf.data = message;
	buf.maxsize = 4;
	buf.cursize = 0;
	MSG_WriteByte(&buf, svc_disconnect);
	count = NET_SendToAll(&buf, 5);
	if (count)
		Con_Printf("Host_ShutdownServer: NET_SendToAll failed for %u clients\n", count);

	for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
		if (host_client->active)
			SV_DropClient(crash);

//
// clear structures
//
	memset (&sv, 0, sizeof(sv));
	memset (svs.clients, 0, svs.maxclientslimit*sizeof(client_t));
}
开发者ID:darkduke606,项目名称:Insomnia-ProQuake-Engine,代码行数:67,代码来源:host.c


示例5: Host_EndGame

/*
================
Host_EndGame
================
*/
void Host_EndGame (char *message, ...)
{
	va_list		argptr;
	char*		string = Sys_BigStackAlloc(1024, "Host_EndGame");

	va_start (argptr,message);
	vsprintf (string,message,argptr);
	va_end (argptr);
	Con_DPrintf ("Host_EndGame: %s\n",string);

	if (sv.active)
		Host_ShutdownServer (false);

	if (cls.state == ca_dedicated)
		Sys_Error ("Host_EndGame: %s\n",string);	// dedicated servers exit

	Sys_BigStackFree(1024, "Host_EndGame");

	if (cls.demonum != -1)
	{
		CL_StopPlayback();
		CL_NextDemo();
	}
	else
		CL_Disconnect ();

	longjmp (host_abortserver, 1);
}
开发者ID:Rinnegatamante,项目名称:vitaQuake,代码行数:33,代码来源:host.c


示例6: Host_Error

/*
================
Host_Error

This shuts down both the client and server
================
*/
void Host_Error (const char *error, ...)
{
	va_list		argptr;
	char		string[1024];
	static	qboolean inerror = false;

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

	SCR_EndLoadingPlaque ();		// reenable screen updates

	va_start (argptr,error);
	q_vsnprintf (string, sizeof(string), error, argptr);
	va_end (argptr);
	Con_Printf ("Host_Error: %s\n",string);

	if (sv.active)
		Host_ShutdownServer (false);

	if (cls.state == ca_dedicated)
		Sys_Error ("Host_Error: %s\n",string);	// dedicated servers exit

	CL_Disconnect ();
	cls.demonum = -1;
	cl.intermission = 0; //johnfitz -- for errors during intermissions (changelevel with no map found, etc.)

	inerror = false;

	longjmp (host_abortserver, 1);
}
开发者ID:bangstk,项目名称:Quakespasm,代码行数:38,代码来源:host.c


示例7: CL_DemoCompleted

/*
=================
CL_DemoCompleted
=================
*/
void CL_DemoCompleted(void)
{
#if NEW_DEMOFUNC
	CL_FreeDemoPoints();
#endif

	if (cl_timedemo && cl_timedemo->integer)
	{
		int time;

		time = Sys_Milliseconds() - clc.timeDemoStart;
		if (time > 0)
		{
			Com_FuncPrinf("%i frames, %3.1f seconds: %3.1f fps\n", clc.timeDemoFrames,
			              time / 1000.0, clc.timeDemoFrames * 1000.0 / time);
		}
	}

	if (CL_VideoRecording())
	{
		Cmd_ExecuteString("stopvideo");
	}

	if (clc.waverecording)
	{
		CL_WriteWaveClose();
		clc.waverecording = qfalse;
	}

	CL_Disconnect(qtrue);
	CL_NextDemo();
}
开发者ID:dstaesse,项目名称:etlegacy,代码行数:37,代码来源:cl_demo.c


示例8: __declspec

/* <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);
}
开发者ID:mefisto2009,项目名称:rehlds,代码行数:33,代码来源:host.cpp


示例9: CL_MapLoading

/*
=====================
CL_MapLoading

A local server is starting to load a map, so update the
screen to let the user know about it, then dump all client
memory on the hunk from cgame, ui, and renderer
=====================
*/
void CL_MapLoading( void ) {
	if ( !com_cl_running->integer ) {
		return;
	}

	Con_Close();
	Key_SetCatcher( 0 );

	// if we are already connected to the local host, stay connected
	if ( cls.state >= CA_CONNECTED && !Q_stricmp( cls.servername, "localhost" ) )  {
		cls.state = CA_CONNECTED;		// so the connect screen is drawn
		memset( cls.updateInfoString, 0, sizeof( cls.updateInfoString ) );
//		memset( clc.serverMessage, 0, sizeof( clc.serverMessage ) );
		memset( &cl.gameState, 0, sizeof( cl.gameState ) );
		clc.lastPacketSentTime = -9999;
		SCR_UpdateScreen();
	} else {
		// clear nextmap so the cinematic shutdown doesn't execute it
		Cvar_Set( "nextmap", "" );
		CL_Disconnect();
		Q_strncpyz( cls.servername, "localhost", sizeof(cls.servername) );
		cls.state = CA_CHALLENGING;		// so the connect screen is drawn
		Key_SetCatcher( 0 );
		SCR_UpdateScreen();
		clc.connectTime = -RETRANSMIT_TIMEOUT;
		NET_StringToAdr( cls.servername, &clc.serverAddress);
		// we don't need a challenge on the localhost

		CL_CheckForResend();
	}

	CL_FlushMemory();
}
开发者ID:Indie-Jones,项目名称:OpenJK,代码行数:42,代码来源:cl_main.cpp


示例10: CL_WebDownloadDoneCb

/*
* CL_WebDownloadDoneCb
*/
static void CL_WebDownloadDoneCb( int status, const char *contentType, void *privatep )
{
	bool disconnect = cls.download.disconnect;
	bool cancelled = cls.download.cancelled;
	bool success = (cls.download.offset == cls.download.size) && (status > -1);

	Com_Printf( "Web download %s: %s (%i)\n", success ? "successful" : "failed", cls.download.tempname, status );

	if( success ) {
		CL_DownloadComplete();
	}

	CL_StopServerDownload();

	if( cancelled ) {
		cls.download.requestnext = false;
	}
	cls.download.web = false;

	// check if user pressed escape to stop the downloa
	if( disconnect ) {
		CL_Disconnect( NULL );
		return;
	}

	/*if( success || cancelled )*/ {
		CL_DownloadDone();
	}
}
开发者ID:ShaitanShootout,项目名称:BM,代码行数:32,代码来源:cl_parse.c


示例11: GAME_SetMode

void GAME_SetMode (const cgame_export_t *gametype)
{
	const cgame_export_t *list;

	if (cls.gametype == gametype)
		return;

	list = GAME_GetCurrentType();
	if (list) {
		Com_Printf("Shutdown gametype '%s'\n", list->name);
		list->Shutdown();

		/* we dont need to go back to "main" stack if we are already on this stack */
		if (!UI_IsWindowOnStack("main"))
			UI_InitStack("main", "", qtrue, qtrue);
	}

	cls.gametype = gametype;

	CL_Disconnect();

	list = GAME_GetCurrentType();
	if (list) {
		Com_Printf("Change gametype to '%s'\n", list->name);
		/* inventory structure switched/initialized */
		INV_DestroyInventory(&cls.i);
		INV_InitInventory(list->name, &cls.i, &csi, &inventoryImport);
		/** @todo this should be in GetCGameAPI */
		list->Init(NULL);
	}
}
开发者ID:chrisglass,项目名称:ufoai,代码行数:31,代码来源:cl_game.c


示例12: Host_Error

/*
================
Host_Error

This shuts down both the client and server
================
*/
void Host_Error (char *error, ...)
{
	va_list		argptr;
	char		string[1024];
	static	qboolean inerror = false;
	
	if (inerror)
		Sys_Error ("Host_Error: recursively entered");
	inerror = true;
	
	SCR_EndLoadingPlaque ();		// reenable screen updates

	va_start (argptr,error);
#if defined (__APPLE__) || defined (MACOSX)
	vsnprintf (string,1024,error,argptr);
#else
	vsprintf (string,error,argptr);
#endif /* __APPLE__ || MACOSX */
	va_end (argptr);
	Con_Printf ("Host_Error: %s\n",string);
	
	if (sv.active)
		Host_ShutdownServer (false);

	if (cls.state == ca_dedicated)
		Sys_Error ("Host_Error: %s\n",string);	// dedicated servers exit

	CL_Disconnect ();
	cls.demonum = -1;

	inerror = false;

	longjmp (host_abortserver, 1);
}
开发者ID:MaddTheSane,项目名称:Quake,代码行数:41,代码来源:host.c


示例13: Host_EndGame

/*
================
Host_EndGame
================
*/
void Host_EndGame (char *message, ...)
{
	va_list		argptr;
	char		string[1024];
	
	va_start (argptr,message);
#if defined (__APPLE__) || defined (MACOSX)
	vsnprintf (string,1024,message,argptr);
#else
	vsprintf (string,message,argptr);
#endif /* __APPLE__ || MACOSX */
	va_end (argptr);
	Con_DPrintf ("Host_EndGame: %s\n",string);
	
	if (sv.active)
		Host_ShutdownServer (false);

	if (cls.state == ca_dedicated)
		Sys_Error ("Host_EndGame: %s\n",string);	// dedicated servers exit
	
	if (cls.demonum != -1)
		CL_NextDemo ();
	else
		CL_Disconnect ();

	longjmp (host_abortserver, 1);
}
开发者ID:MaddTheSane,项目名称:Quake,代码行数:32,代码来源:host.c


示例14: SV_Shutdown

/*
================
SV_Shutdown

Called when each game quits,
before Sys_Quit or Sys_Error
================
*/
void SV_Shutdown( char *finalmsg ) {
	if ( !com_sv_running || !com_sv_running->integer ) {
		return;
	}

	Com_Printf( "----- Server Shutdown -----\n" );

	if ( svs.clients && !com_errorEntered ) {
		SV_FinalMessage( finalmsg );
	}

	SV_RemoveOperatorCommands();
	SV_MasterShutdown();
	SV_ShutdownGameProgs();

	// free current level
	SV_ClearServer();

	// free server static data
	if ( svs.clients ) {
		//Z_Free( svs.clients );
		free( svs.clients );    // RF, avoid trying to allocate large chunk on a fragmented zone
	}
	memset( &svs, 0, sizeof( svs ) );

	Cvar_Set( "sv_running", "0" );

	Com_Printf( "---------------------------\n" );

	// disconnect any local clients
	CL_Disconnect( qfalse );
}
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:40,代码来源:sv_init.c


示例15: Host_Map_f

/*
======================
Host_Map_f

handle a
map <servername>
command from the console.  Active clients are kicked off.
======================
*/
void Host_Map_f (void)
{
	int		i;
	char	name[MAX_QPATH], *p;

	if (Cmd_Argc() < 2)	//no map name given
	{
		if (cls.state == ca_dedicated)
		{
			if (sv.active)
				Con_Printf ("Current map: %s\n", sv.name);
			else
				Con_Printf ("Server not active\n");
		}
		else if (cls.state == ca_connected)
		{
			Con_Printf ("Current map: %s ( %s )\n", cl.levelname, cl.mapname);
		}
		else
		{
			Con_Printf ("map <levelname>: start a new server\n");
		}
		return;
	}

	if (cmd_source != src_command)
		return;

	cls.demonum = -1;		// stop demo loop in case this fails

	CL_Disconnect ();
	Host_ShutdownServer(false);

	if (cls.state != ca_dedicated)
		IN_Activate();
	key_dest = key_game;			// remove console or menu
	SCR_BeginLoadingPlaque ();

	svs.serverflags = 0;			// haven't completed an episode yet
	q_strlcpy (name, Cmd_Argv(1), sizeof(name));
	// remove (any) trailing ".bsp" from mapname -- S.A.
	p = strstr(name, ".bsp");
	if (p && p[4] == '\0')
		*p = '\0';
	SV_SpawnServer (name);
	if (!sv.active)
		return;

	if (cls.state != ca_dedicated)
	{
		memset (cls.spawnparms, 0, MAX_MAPSTRING);
		for (i = 2; i < Cmd_Argc(); i++)
		{
			q_strlcat (cls.spawnparms, Cmd_Argv(i), MAX_MAPSTRING);
			q_strlcat (cls.spawnparms, " ", MAX_MAPSTRING);
		}

		Cmd_ExecuteString ("connect local", src_command);
	}
}
开发者ID:ProfessorKaos64,项目名称:vkQuake,代码行数:69,代码来源:host_cmd.c


示例16: Host_Error

//This shuts down both the client and server
void Host_Error (char *error, ...)
{
	va_list argptr;
	char string[1024];
	static qbool inerror = false;

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

	va_start (argptr,error);
	vsnprintf (string, sizeof(string), error, argptr);
	va_end (argptr);

	Com_Printf ("\n===========================\n");
	Com_Printf ("Host_Error: %s\n",string);
	Com_Printf ("===========================\n\n");

	CL_Disconnect ();

	if (!host_initialized)
		Sys_Error ("Host_Error: %s", string);

	inerror = false;

	Host_Abort ();
}
开发者ID:jite,项目名称:jquake,代码行数:28,代码来源:host.c


示例17: SV_Shutdown

/*
================
SV_Shutdown

Called when each game quits,
before Sys_Quit or Sys_Error
================
*/
void SV_Shutdown( char *finalmsg ) {
	if ( !com_sv_running || !com_sv_running->integer ) {
		return;
	}

	Com_Printf( "----- Server Shutdown -----\n" );

	if ( svs.clients && !com_errorEntered ) {
		SV_FinalMessage( finalmsg );
	}

	SV_RemoveOperatorCommands();
	SV_MasterShutdown();
	SV_ShutdownGameProgs();

	// free current level
	SV_ClearServer();

	// free server static data
	if ( svs.clients ) {
		Z_Free( svs.clients );
	}
	Com_Memset( &svs, 0, sizeof( svs ) );

	Cvar_Set( "sv_running", "0" );
	Cvar_Set("ui_singlePlayerActive", "0");

	Com_Printf( "---------------------------\n" );

	// disconnect any local clients
	CL_Disconnect( qfalse );
}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:40,代码来源:sv_init.c


示例18: SV_Shutdown

/*
================
SV_Shutdown

Called when each game quits,
before Sys_Quit or Sys_Error
================
*/
void SV_Shutdown( char *finalmsg ) 
{
	if ( !com_sv_running || !com_sv_running->integer ) 
		return;

	Com_Printf( "----- Server Shutdown -----\n" );

	if( theSVS.svClients_.size() && !com_errorEntered ) {
		SV_FinalMessage( finalmsg );
	}

	//SV_RemoveOperatorCommands();
	//SV_MasterShutdown();
	SV_ShutdownGameProgs();

	// free current level
	SV_ClearServer();

	// free server static data
//	if( theSVS.clients_ ) 
//		Z_Free( theSVS.clients_ );
//	theSVS.clearClients();// done in theSVS.clear()

///	Com_Memset( &svs, 0, sizeof( svs ) );
	theSVS.clear();

	Cvar_Set( "sv_running", "0" );
	Cvar_Set("ui_singlePlayerActive", "0");

	Com_Printf( "---------------------------\n" );

	// disconnect any local clients
	CL_Disconnect( false );
}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:42,代码来源:sv_init.c


示例19: Host_Quit

void Host_Quit()
{
	CL_Disconnect ();
	Host_ShutdownServer(false);

	Sys_Quit ();
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:7,代码来源:host_cmd.cpp


示例20: CL_Disconnect_f

void
CL_Disconnect_f(void)
{
    CL_Disconnect();
    if (sv.active)
	Host_ShutdownServer(false);
}
开发者ID:dommul,项目名称:blinky,代码行数:7,代码来源:cl_main.c



注:本文中的CL_Disconnect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CL_Exception函数代码示例发布时间:2022-05-30
下一篇:
C++ CL_DEBUG_PRINT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap