From f6fdd54a5ffa22f7991490390d19a7fa386af03d Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 23 Feb 2006 20:53:03 +0000 Subject: Detect when clients are disconnected from the server, recover cleanly and display a message. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 383 --- src/net_client.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/net_client.c b/src/net_client.c index a2198200..627561c4 100644 --- a/src/net_client.c +++ b/src/net_client.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: net_client.c 382 2006-02-23 20:31:09Z fraggle $ +// $Id: net_client.c 383 2006-02-23 20:53:03Z fraggle $ // // Copyright(C) 2005 Simon Howard // @@ -21,6 +21,10 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.31 2006/02/23 20:53:03 fraggle +// Detect when clients are disconnected from the server, recover cleanly +// and display a message. +// // Revision 1.30 2006/02/23 20:31:09 fraggle // Set ticdup from the command line with the -dup parameter. // @@ -279,6 +283,23 @@ static void NET_CL_PlayerQuitGame(player_t *player) } } +// Called when we become disconnected from the server + +static void NET_CL_Disconnected(void) +{ + int i; + + // disconnected from server + + players[consoleplayer].message = "Disconnected from server"; + + for (i=0; icmds as // patches against recvwindow_cmd_base. Place the results into // the d_net.c structures (netcmds/nettics) and save the new ticcmd @@ -385,8 +406,6 @@ void NET_CL_StartGame(void) else settings.ticdup = 1; - - // Start from a ticcmd of all zeros memset(&last_ticcmd, 0, sizeof(ticcmd_t)); @@ -888,8 +907,8 @@ void NET_CL_Run(void) if (client_connection.state == NET_CONN_STATE_DISCONNECTED || client_connection.state == NET_CONN_STATE_DISCONNECTED_SLEEP) { - // disconnected from server - + NET_CL_Disconnected(); + NET_CL_Shutdown(); } -- cgit v1.2.3