summaryrefslogtreecommitdiff
path: root/src/strife
diff options
context:
space:
mode:
authorSimon Howard2011-10-19 23:26:23 +0000
committerSimon Howard2011-10-19 23:26:23 +0000
commitd6693cc9e17fdbee7033e47b7b8da249da118d8f (patch)
treec67b9375d1fe1d52cbb7bb258d0bbacacc61631c /src/strife
parentc31392111bbb81043b70531264f0e06f51b174cd (diff)
downloadchocolate-doom-d6693cc9e17fdbee7033e47b7b8da249da118d8f.tar.gz
chocolate-doom-d6693cc9e17fdbee7033e47b7b8da249da118d8f.tar.bz2
chocolate-doom-d6693cc9e17fdbee7033e47b7b8da249da118d8f.zip
Fix lockups in Hexen and Strife when playing with more than four
players. Subversion-branch: /branches/v2-branch Subversion-revision: 2444
Diffstat (limited to 'src/strife')
-rw-r--r--src/strife/p_enemy.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/strife/p_enemy.c b/src/strife/p_enemy.c
index 79e6ffb8..c7104a75 100644
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -803,9 +803,17 @@ P_LookForPlayers
sector = actor->subsector->sector;
c = 0;
- stop = (actor->lastlook-1)&3;
- for ( ; ; actor->lastlook = (actor->lastlook+1)&3 )
+ // NOTE: This behavior has been changed from the Vanilla behavior, where
+ // an infinite loop can occur if players 0-3 all quit the game. Although
+ // technically this is not what Vanilla does, fixing this is highly
+ // desirable, and having the game simply lock up is not acceptable.
+ // stop = (actor->lastlook - 1) & 3;
+ // for (;; actor->lastlook = (actor->lastlook + 1) & 3)
+
+ stop = (actor->lastlook + MAXPLAYERS - 1) % MAXPLAYERS;
+
+ for ( ; ; actor->lastlook = (actor->lastlook + 1) % MAXPLAYERS)
{
if (!playeringame[actor->lastlook])
continue;