From f0c7aa035a81c84e26edd0cd9aafd13f00e0a2fe Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 9 Aug 2007 00:04:03 +0000 Subject: Don't crash when all players have quit. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 955 --- src/am_map.c | 12 ++++++++++-- src/d_net.c | 32 +++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/am_map.c b/src/am_map.c index 347d592f..cad46a70 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -472,13 +472,21 @@ void AM_initVariables(void) m_w = FTOM(f_w); m_h = FTOM(f_h); + plr = &players[0]; + // find player to center on initially if (!playeringame[pnum = consoleplayer]) + { for (pnum=0;pnummo->x - m_w/2; m_y = plr->mo->y - m_h/2; AM_changeWindowLoc(); diff --git a/src/d_net.c b/src/d_net.c index b8ecd645..4e87a813 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -207,7 +207,6 @@ void NetUpdate (void) } #endif - netcmds[consoleplayer][maketic % BACKUPTICS] = cmd; ++maketic; @@ -408,6 +407,23 @@ void D_QuitNetGame (void) } +// Returns true if there are currently any players in the game. + +static boolean PlayersInGame(void) +{ + int i; + + for (i=0; i lowtic) I_Error ("gametic>lowtic"); if (advancedemo) @@ -592,3 +617,4 @@ void TryRunTics (void) NetUpdate (); // check for new console commands } } + -- cgit v1.2.3