Exemple #1
0
/*
================
CL_Connect_f

MAUTH version -- kick off an authentication sequence as first part of
connection routine.
================
*/
void CL_Connect_f (void)
{
	char	*server;
	char	*masterserver;
    char    data[2048];

	if (Cmd_Argc() != 3)
	{
		Com_Printf ("usage: connect <master> <server>\n");
		return;
	}
	
	Host_EndGame ();
	
    server = Cmd_Argv (1);
	strlcpy (cls.servername, server, sizeof(cls.servername));

    // Have to check for valid server address here as we must send to master...
	if (!NET_StringToAdr (cls.servername, &cls.server_adr))
	{
		Com_Printf ("Bad server address\n");
		return;
	}
	if (cls.server_adr.port == 0)
		cls.server_adr.port = BigShort (PORT_SERVER);

	masterserver = Cmd_Argv (2);
	strlcpy (cls.masterservername, masterserver, sizeof(cls.masterservername));

    // Start off auth sequence before trying to connect...
	if (!NET_StringToAdr (cls.masterservername, &cls.masterserver_adr))
	{
		Com_Printf ("Bad master server address\n");
		return;
	}
	if (cls.masterserver_adr.port == 0)
		cls.masterserver_adr.port = BigShort (27000);  // master port

	Com_Printf ("Attempting to auth with %s...\n", cls.masterservername);
	sprintf (data, "%c\n%s\n%s:%d\n",
            C2M_AUTH_INIT,
            Cvar_String("name"),
            cls.servername,
            cls.server_adr.port);
	NET_SendPacket (NS_CLIENT, strlen(data), data, cls.masterserver_adr);

    // Normal connection procedure...
    // FIXME wait?
    // FIXME use some qbools to work out if we get a NACK to stop trying to connect -- ie preserve state
	CL_BeginServerConnect();
}
Exemple #2
0
/*
================
CL_Connect_f

================
*/
void CL_Connect_f (void)
{
	char	*server;

	if (Cmd_Argc() != 2)
	{
		Con_Printf ("usage: connect <server>\n");
		return;	
	}
	
	server = Cmd_Argv (1);

	CL_Disconnect ();

	strncpy (cls.servername, server, sizeof(cls.servername)-1);
	CL_BeginServerConnect();
}
Exemple #3
0
static void
CL_Connect_f (void)
{
	const char *server;

	if (Cmd_Argc () != 2) {
		Sys_Printf ("usage: connect <server>\n");
		return;
	}

	server = Cmd_Argv (1);

	CL_Disconnect ();
	CL_Chat_Flush_Ignores ();

	dstring_copystr (cls.servername, server);
	CL_BeginServerConnect ();
}
Exemple #4
0
void CL_NQConnect_f (void)
{
	char	*server;

	if (Cmd_Argc() != 2)
	{
		Com_Printf ("usage: nqconnect <server>\n");
		return;
	}
	
	server = Cmd_Argv (1);

	Host_EndGame ();

	cls.nqprotocol = true;
	strlcpy (cls.servername, server, sizeof(cls.servername));
	CL_BeginServerConnect();
}
Exemple #5
0
/*
====================
CL_ReRecord_f

record <demoname>
====================
*/
void CL_ReRecord_f (void)
{
	int		c;
	char	name[MAX_OSPATH];

	c = Cmd_Argc();
	if (c != 2)
	{
		Con_Printf ("rerecord <demoname>\n");
		return;
	}

	if (!*cls.servername) {
		Con_Printf("No server to reconnect to...\n");
		return;
	}

	if (cls.demorecording)
		CL_Stop_f();

#if defined (__APPLE__) || defined (MACOSX)
	snprintf (name, MAX_OSPATH, "%s/%s", com_gamedir, Cmd_Argv(1));
#else
	sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));
#endif /* __APPLE__ || MACOSX */

//
// open the demo file
//
	COM_DefaultExtension (name, ".qwd");

	cls.demofile = fopen (name, "wb");
	if (!cls.demofile)
	{
		Con_Printf ("ERROR: couldn't open.\n");
		return;
	}

	Con_Printf ("recording to %s.\n", name);
	cls.demorecording = true;

	CL_Disconnect();
	CL_BeginServerConnect();
}