ref: f6fdd54a5ffa22f7991490390d19a7fa386af03d
parent: 18734cdb38cf5576f306734fce3b9882d6cc541d
author: Simon Howard <fraggle@gmail.com>
date: Thu Feb 23 15:53:03 EST 2006
Detect when clients are disconnected from the server, recover cleanly and display a message. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 383
--- 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 @@
}
}
+// 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; i<MAXPLAYERS; ++i)
+ {
+ if (i != consoleplayer)
+ playeringame[i] = false;
+ }
+}
+
// Expand a net_full_ticcmd_t, applying the diffs in cmd->cmds 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 @@
else
settings.ticdup = 1;
-
-
// Start from a ticcmd of all zeros
memset(&last_ticcmd, 0, sizeof(ticcmd_t));
@@ -888,8 +907,8 @@
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();
}