diff options
author | Simon Howard | 2006-02-23 20:53:03 +0000 |
---|---|---|
committer | Simon Howard | 2006-02-23 20:53:03 +0000 |
commit | f6fdd54a5ffa22f7991490390d19a7fa386af03d (patch) | |
tree | f162a9adef7a7ff72ccf028a3a64d35792462522 /src/net_client.c | |
parent | 18734cdb38cf5576f306734fce3b9882d6cc541d (diff) | |
download | chocolate-doom-f6fdd54a5ffa22f7991490390d19a7fa386af03d.tar.gz chocolate-doom-f6fdd54a5ffa22f7991490390d19a7fa386af03d.tar.bz2 chocolate-doom-f6fdd54a5ffa22f7991490390d19a7fa386af03d.zip |
Detect when clients are disconnected from the server, recover cleanly
and display a message.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 383
Diffstat (limited to 'src/net_client.c')
-rw-r--r-- | src/net_client.c | 29 |
1 files changed, 24 insertions, 5 deletions
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; 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 @@ 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(); } |